Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

HARD Moon Landing

http://o.ooli.ca/en/scratchgames/moon
Can you land the moon lander in this simulation of the
low gravity of the moon? Your space ship is fragile. If
you touch the rocks or if you land too fast, your ship will
fall apart.

When you open this program, you will see a space


background and one sprite: the moon lander. In this
program, you will write code for simulating what it is like
to move in space and what gravity on the moon is like.

(Finished game: http://scratch.mit.edu/projects/30358794/)

Useful blocks for this exercise


Motion Looks
move steps switch costume to

turn degrees Data


go to x: y: set speed to

change x by change speed by

change y by
Events

Control when clicked


wait secs
Sensing
forever
touching color

key pressed?
if then
Operators
and
stop all
>
MEDIUM
1. Basic Movement 2. Crashing

MEDIUM
Start by writing a program that let’s you move Click on the costumes tab of the lunar lander sprite. Look at the
the space ship in a simple way. Some code different costumes for the sprite. Change your program so that if
has already been written for moving the ship the ship touches the rocks it will explode. Since all the rocks are
to the left and right. The spaceship uses “x” to grey, your program should check if the ship is touching something
show where it is to the left and right. It uses grey, and if it is, it should switch to the “explosion” costume and
“y” to show where it is up and down. Finish stop the program. Also, when the green flag is pressed to start the
writing the code for moving the ship up and game, you should switch to the starting “lunar_lander” costume.
down.

3. Space Movement
HARD

In space, there is no air. That Create a variable called “x speed” for In space, when you use thrusters,
means that when you move in the sprite that keeps track of how fast your ship keeps moving even after
space, there is no air to get in your the ship is moving left or right. During the thrusters stop. Change your
way and slow you down. If you the game, the “x” position of the ship program so that when you press the
start moving in one direction, you should be regularly changed by the “x left and right arrow keys, the “x
will keep moving in that direction. speed” that the ship is moving at. This speed” changes instead of directly
You can use variables to show way, if you start moving at a speed of 1 moving the ship. That way, the ship
what it’s like to move in space. step to the right, the ship will keep will keep moving even when your
Let’s start with moving left and moving 1 step to the right again and thrusters are off, just like in real life.
right. again.

4. Up and Down 5. Moon Gravity 6. Landing


HARD

HARD

HARD

Now that you’ve written The moon has very weak Change your program so that if the lander
code to move the space gravity that pulls things to the touches the yellow landing pad, the game ends.
ship left and right using ground. Gravity makes things
space movement, do the fall to the ground faster and If you land on the landing pad while moving too
same for moving up and faster until they hit something. fast, the ship will fall apart. Add code to your
down. Use a variable Add gravity to your program by program so that if your speed is too fast when you
called “y speed” to having the “y speed” of your touch the landing pad, your ship will explode.
change the “y” position of ship slowly change by -0.1.
the ship.

Try It: Fuel Try It: Thrusters Try It: New Maps
HARD

MEDIUM-HARD

MEDIUM

Space ships have only a small amount of fuel. The sprite for the spaceship If you click on the stage,
Astronauts need to land their ship before h a s d i ff e r e n t c o s t u m e s you can go to the
running out of fuel. Make a variable called “fuel” showing different thrusters backdrops tab to change
for your program. When your game starts, your being used. Change your the terrain on the moon.
ship should start with 100 fuel. Every time you program so that when you Can you make your own
use your thrusters, you should lose fuel. If you press the arrow keys, the moon surface?
run out of fuel, then your thrusters shouldn’t correct thruster is shown.
work any more.

You might also like