Page 97 - 2502_Pakistan-kifayat_C-8
P. 97
When the green flag or Go button is clicked, the script creates a clone of the sprite. Each clone then
starts running its own script and moves to a random position on the stage, causing multiple copies of
the sprite to appear scattered randomly.
DESIGNING GAME
Egg Escape is a game where you help the chick bounce up and down to avoid being hit by the egg.
Instructions to create the game script in Scratch:
Delete the default sprite.
Add a sprite: Click on Choose a Sprite and select the Chick sprite.
Add another sprite: select the Egg sprite.
Change your backdrop: Select the Blue Sky backdrop from the list of backdrops.
Add the following script to the Chick sprite: When the space key is pressed, the Chick sprite
makes a "Chirp" sound and moves up 10 steps ten times, then moves down 10 steps ten times. After
this, the Score goes up by 1.
When the green flag is clicked, the Level starts at 1. After 5 seconds, it changes to 2. After 5 more
seconds, it changes to 3. Then it stays there.
At the same time, the Timer is set to 20 and counts down by 1 every second. When the Timer reaches
0, the backdrop changes to "Blue Sky2," the Egg moves to (-185, -123), and the game stops.
#Intermediate Level Programming 95

