Space Quest Survival

About this lesson

Free Trial (4th - 5th)

Step 1
In this lesson we'll be learning to make a scifi-space survival game

You must survive by jumping over robocrabs and dodging lasers to earn points. Try to survive as long as you can!

Step 2
Follow the link to Scratch and remix this project.
Step 3
Press "See Inside"
Step 4
Give your character fluid movement.

Add these two blocks of code to the "Player" sprite.

The blocks are color-coded to match their category

Check Your Work
Step 5
Press the Green Flag and the Left and Right Arrow keys

Make sure you can move LEFT and RIGHT

Step 6
Make a new variable called "Gravity"
Step 7
If you are touching the ground- set gravity to 0. Otherwise we increase the gravity
Step 8
Add this to make gravity move the player down

Positive gravity moves the player up.
Negative gravity moves the player down.

Step 9
When the Flag is Clicked we will set Gravity to 0 and place the player in the center
Check Your Work
Step 10
Click the Green Flag and the player should start in the center and fall to the ground
Step 11
If the player presses the up-arrow and they are touching the ground, then they jump

Making gravity positive, makes the player go up!

Check Your Work
Step 12
You should now be able to jump but only when you are on the ground!

Press up-arrow to jump

Step 13
This block of code will animate our Player Sprite and set his position.
Step 14
Make another variable and call this one "Score". We will come back to this later.
Step 15
When the game starts we set Score to 0. Also we'll need to Show the player and put them in front of everything

Add the highlighted code blocks to your "When Flag Clicked" stack.

Step 16
Next we're going to add the Robocrabs and the Laser

If the player touches either of these- they'll go boom!

Step 17
Lastly, add this so that when our player touches either the lazer or Robocrab the game ends.
Step 18
Add a "broadcast message" block here
Step 19
Select the message drop-down and pick "New Message"
Step 20
Create a new message named "Explode"
Step 21
Repeat these steps to make another broadcast message, "Game Over"
Step 22
Now add this to the "Boom" sprite. This will set the sprite's position to the Player's.
Step 23
Next, add this to the "Lazer" sprite to set the sprites position.
Step 24
Adding this block to the Lazer sprite will make it appear and disappear
Check Your Work
Step 25
There should now be a Laser the appears and disappears and explodes the player if they touch it

But really we're just making the player hide and an explosion appears on top of them!

Step 26
Now add this block of code to the "Robocrab" sprite so that it will create clones of itself.

Imagine a Robocrab factory popping out robocrabs!

Step 27
We can control the clones with this "Control" Block
Step 28
Add all 3 of these blocks of code to the Robocrab to set it's position, animate it, and change the player's score.

Start on the right and glide to the left:

Step 29
When it gets the the left side, it adds 1 to the player's score and gets deleted
Step 30
Lastely we'll add this to animate the Robocrab as it moves
Check Your Work
Step 31
Make sure your crabs glide from right to left, animate, and disappear when they reach the edge

You'll have to jump over them so they don't destroy you!

Step 32
Untick gravity so that the variable doesn't display on the screen
Step 33
Add these blocks to the "Cannon" sprite to change it's costume when the Lazer sprite spawns in.
Step 34
Lastly, add these two blocks to the "Game Over" Sprite to make the sprite appear when the game is lost.
Check Your Work
Step 35
You've now completed this game!

Try one of these lessons next:

Space Quest Survival Info



Created By



Free Trial Lessons

Access Level


For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.

Learn more about MVCode Teach