Press the green flag and watch the Scratch cat forever draw a tree with changing angles.
For this project I've created a custom block which draws the tree. The "tree" block has several inputs, and only runs its code if the input named "level" isn't zero. At two points in its script, the "tree" block has a copy of itself! This is called (branching) "recursion". Note how when calling itself, it decreases the "level" input. Now you understand why at the beginning of the script the block checks whether the level isn't zero. This is called the "base case", and makes sure that the block doesn't go on forever.
Recursion is one of the coolest features of Scratch 2.0!
In the block's options I've decided to let it "Run without screen refresh", so the tree is drawn all at once. This way clearing the stage, and re-drawing it with a different angle creates the illusion of something actually moving, an animation.
Ready to Remix!
Add your ideas! You could try:
- drawing a new costume
- changing the scripts
- creating a new sprite