Scratch for Java (Version 5.8.0)
Scratch for Java lets you keep everything you learned in
Scratch β sprites, costumes, the stage, move,
say, when key pressed β and write it as Java instead of dragging it.
It is built for the moment a class outgrows Scratch but is not ready to start Java from an empty file.
import org.openpatch.scratch.*;
public class MyStage extends Stage {
public MyStage() {
Sprite bunny = new Sprite();
bunny.addCostume("bunny1_stand");
this.add(bunny);
}
}
That is a complete program, and it needs no image files: 922 pictures and 266 sounds are built in.
Here is one running. Press βΆ β then change a number or a costume name and start it again, it is a real editor. Every tutorial and every method in the documentation comes with a box like this one.
I'm learning
- Your first program: ten minutes, right here in the browser, nothing to install.
- Seven tutorials: from a walking alien to a game with a title screen, one new idea at a time.
- Scratch β Java cheat sheet: which Java line replaces which block.
- It doesn't work!: the most common mistakes and how to fix them.
- Glossary: class, object, method and the other new words.
Then pick a picture from the built-in sprites and sounds, look at the examples, or look up any method in the documentation. Every method there shows the Scratch block it replaces and an example you can run.
I'm teaching
- For teachers: planning a unit, what each tutorial covers, assessment and working offline.
- Setup: browser, Studio, BlueJ or VS Code.
- Multiple Approach Design: classes first or classes later.
- Abiturklassen NRW: the version for the NRW Zentralabitur.
Deutschsprachiges Material findest du in Hyperbook Informatik: den Lernpfad Grundlagen der Programmierung mit Java und die Spielwerkstatt, in der du ΓΌber ein ganzes Schuljahr dein eigenes Spiel entwickelst.
Seeing it side by side
The following video shows a Scratch project and a similar BlueJ project using the Scratch for Java library.
If you want to compare it yourself, you can take a look inside both projects:
- Scratch: https://scratch.mit.edu/projects/338613208
- BlueJ: Source Code on GitHub or Project Halloween.zip
Special Thanks
The Scratch for Java library is profiled using Java Profiler