How to create flying/falling objects in Scratch

In this tutorial we will get a spaceship to fall from the top to the bottom of the screen.

scratch_FlyingRocket

Add the following code to your sprite (e.g. Spaceship):

scratch_FlyingRocketScript

xy-gridTo understand this script you need to understand how x and y coordinates work in Scratch.
When using scratch the “playing area” is based on the following grid:

  • The centre of the grid is (x=0, y=0)
  • The bottom left corner is (x=-240, y=-180)
  • The top right corner is (x=240, y=180)

 

You can download this helpsheet as a pdf: How to create flying or falling objects in Scratch

Share Button
Posted in Block Programming, Computer Science, Scratch Tagged with: , , ,

Our Latest Book