Click, Press, Go! š
Events: make a rocket launch when you click it or press a key.
Click, Press, Go! š
Events are things that happen: a click, a key press, the green flag. Each event can start its own script.
Click the rocket to launch it
when this sprite clicked say [3... 2... 1...] for (2) seconds glide (1) secs to x: (0) y: (170)
Press a key
when [space v] key pressed change y by (20)
Every time you press space, the rocket goes up a little!
Start from the same place
Put your rocket back on the ground when the green flag is clicked:
when flag clicked go to x: (0) y: (-130)
š”š§ One sprite can have lots of scripts, each with its own event on top.
š ļø Build it!
- Choose the Rocketship sprite and a space backdrop (click š¼ļø in the bottom corner).
- Build all three scripts above.
- Click the š¢ flag, then click the rocket. Liftoff! š
- Click the flag again and try the space key.
ā Bonus: make the down arrow key move the rocket back down (use change y by (-20)).
š Fun fact
From space, astronauts see Earth as a blue ball. That's because about 70% of our planet is covered by oceans! š
Build it in Scratch!
Open Scratch in a new tab, find the blocks shown above (they're the same colors!), snap them together and click the green flag. Then try the challenge ideas in the lesson.
Open Scratch āScratch is free and made by MIT for kids. You can build without an account. To keep a project, ask a grown-up to help you sign in, or use File ā Save to your computer.