Each sprite has a "program" that determines its actions, e.g. "move 10 steps". The program is build using drag and drop in a visual editor. Each change in the program influences the running program immediately.
The statements inside the "forever" block determine how the soccer ball moves on the screen. The ball does two things: (1) it moves 10 steps and (2) when it hits a wall (edge), it bounces. And it is doing this forever.
The program also contains some behavior for the case that the soccer ball and the tennis ball hit each other. The soccer ball does a special move and turn its direction. Also it sends a message to the tennis ball. The program of the tennis ball has a special subprogram (not shown here) to react on this message: the tennis ball says "ough" and changes its color.
The video below shows the animation as created by this project. It is a simple animation (the Scratch website shows thousands and thousands of much better ones), but it gives an impression of what we are talking about.
By using Scratch, kids learn the following programming aspects:
- A program has a start (in this case, the program starts by pressing the green flag)
- A program consists of a sequence of statements
- A programming language has many different statements, like repeat, if-then-else, compare, IO-statements
- IO-statements can show results (e.g. move a sprite 10 steps forward) to the user
- IO-statements can use input from the user (e.g. move a sprite to the cursor)
- A program can consist of several simultaneous running subprograms (each sprite has its own program running)
- Subprograms can interact (send message to other sprite, wait for message from other sprite)
- A program can use variables