Releases: openpatch/scratch-for-java
v3.2.1
v3.2.0
v3.1.0
3.1.0
- 🚀 Feat: The debug modus now shows the current FPS.
- 🚀 Feat:
isTouchingSprite(Class)
. IsTouchingSprite accepts also a Class, so you can check the collision with all objects of this class.
v3.0.0
3.0.0
Scratch for Java will from now on focus on being a standalone library. Even though it can be used in processing.
We also provide os-specific jar files for the standalone version.
v2.1.0
Changes
- 🚀 Feat: Image, Text and Pen can now be added without being used in a Sprite. Example:
import org.openpatch.scratch.Stage;
import org.openpatch.scratch.extensions.Pen;
public class PenStandalone {
public static void main(String[] args) {
Stage s = new Stage(400, 400);
Pen p = new Pen();
p.down();
p.setPosition(40, 40);
p.setPosition(40, 100);
}
}
- 🚀 Feat: AnimatedSprite and Sprite now support SpriteSheets. Example:
import org.openpatch.scratch.AnimatedSprite;
import org.openpatch.scratch.Stage;
public class SpriteSheet {
public static void main(String[] args) {
Stage stage = new Stage() ;
stage.add(new AnimatedBee());
}
}
class AnimatedBee extends AnimatedSprite {
public AnimatedBee() {
this.addAnimation("idle", "bee_idle.png", 6, 36, 34);
}
public void run() {
this.playAnimation("idle");
}
}
- 🐛 Fix: Pen did not include the first point
BREAKING CHANGES
- 💥 Prefix Scratch is removed. For exmaple: ScratchSprite -> Sprite, ScratchStage -> Stage
- 💥 getInstance and init got removed from Stage. You now have to instantiate a Stage like a normal Object
new Stage(this) // Processing
ornew Stage(400, 400) // Standalone
. Be aware that you can only have one Stage at a time.
v2.0.0
The Processing library Scratch changed owners. It is now hosted under the OpenPatch organization, therefore the package name change. You can now access the classes of this library like so:
import org.openpatch.scratch.*
v1.15.0
The Standalone Release
This release does not change the behaviour of the Processing library!
You can now use the scratch-standalone.jar
for using this library in any Java environment. When you use this library outside of processing, you have to create a new object of the class ScratchStage. The init
-method will only work in Processing.
import eu.barkmin.processing.scratch.*;
public class MyProgram
{
public MyProgram() {
ScratchStage s = new ScratchStage(800, 400);
s.addSprite(new Cat());
}
}
class Cat extends ScratchSprite
{
public Cat() {
this.addCostume("sitzen", "sprites/cat.png");
this.setOnEdgeBounce(true);
}
public void run() {
this.move(1);
}
}
You can also use this library outside of Processing in a more imperative way, similar to Shapes and Sprites. For this to work, the wait
-method was added to the ScratchStage class.
import eu.barkmin.processing.scratch.*;
public class MyProgram
{
public MyProgram() {
ScratchStage s = new ScratchStage(400, 400);
ScratchSprite cat = new ScratchSprite(
"sitzen", "sprites/cat.png"
);
s.addSprite(cat);
cat.setOnEdgeBounce(true);
while(!s.isKeyPressed(27)) {
cat.move(1);
s.wait(100);
}
}
}
v1.14.2
- Remove System.out.print statements
v1.14.1
- improve ScratchText rendering
v1.14.0
- add think and say to ScratchSprite
- add display to ScratchStage
- add whenClicked to Sprite
- add whenBackdropSwitches to Sprite