Posted on

Scratch Coding – Spaceship Lander

We are going to be building a spaceship landing game.

The program should have the following goals:

  • The player will use the arrow keys to apply power to the rocket
    • Up will move the rocket down
    • Down will move the rocket Up
    • Left will move the rocket Right
  • The spaceship should be travelling less than 0.5 on the X and Y to successfully land

Prepare the rocket sprite costumes

Use the drawing tools to create a number of costumes that we can use to make our rocket look like it is thrusting in the correct direction.






We will need a way to keep track of the rocket speed, to do this we will need a way to store the X (across) and Y (up / down) speed of the rocket.

Create two new variables called X and Y.

Rocket Speed

We need a way for our rocket to be able to move along, we always want to be checking for movement while the game is running, so we should be using a forever block for this. We need a loop for the X axis and a loop for the Y axis.

Using Keys to Control Movement

Each arrow key press will need to add some speed to the rocket.

Task: Add the Down / Left / Right arrow code.

The left arrow should change the X axis by -0.5 and use the right costume

The right arrow should change the X axis by 0.5 and use the left costume

The down arrow should change the Y axis by -0.25 (make it harder to slow down) and use the up costume.

Planet Sprites

Add a take-off sprite and a landing sprite to your game. I’ve used planets to work with the theme.


Create two new backdrops:

  • A great landing backdrop for when the rocket lands
  • A crashed backdrop for when the rocket hits the planet too quickly

Ensure that both planet sprites start in the correct location:

Landing Site

We want to make sure that our landing site is always waiting for the rocket to touch it. Once it does we need to test the speed of the rocket and if the rocket is travelling slow, we will show the landed backdrop. Otherwise we will show the crashed backdrop.