Lost in Space
Lost in Space
Lost in Space
Projects
Lost in space
Learn how to program your own animation!
Step 1 Introduction
https://projects.raspberrypi.org/en/projects/lost-in-space/print 1/21
1/26/23, 11:02 AM Lost in space
https://projects.raspberrypi.org/en/projects/lost-in-space/print 2/21
1/26/23, 11:02 AM Lost in space
Your first step will be to create a spaceship that flies towards the Earth!
https://projects.raspberrypi.org/en/projects/lost-in-space/print 3/21
1/26/23, 11:02 AM Lost in space
You can search for a sprite, or browse for one by category. Click on a sprite to add it to your project.
https://projects.raspberrypi.org/en/projects/lost-in-space/print 4/21
1/26/23, 11:02 AM Lost in space
Use the arrow tool to click and drag a box around the whole spaceship image. Then click on the circular
rotate handle, and rotate the image until it is on its side.
https://projects.raspberrypi.org/en/projects/lost-in-space/print 5/21
1/26/23, 11:02 AM Lost in space
when clicked
point in direction 0
go to x: -150 y: -150
glide 1 secs to x: 0 y: 0
Change the numbers in the code blocks you’ve added so that the code is exactly the same as above.
If you click the green flag, you should see the spaceship speak, turn, and glide towards the centre of the stage.
https://projects.raspberrypi.org/en/projects/lost-in-space/print 6/21
1/26/23, 11:02 AM Lost in space
Challenge!
glide 1 secs to x: 0 y: 0
Scratch coordinates
Scratch coordinates
In Scratch, the coordinates x:0, y:0 mark the central position on the Stage.
A position like x:-200, y:-100 is towards the bottom left on the Stage, and a position like x:200, y:100 is
near the top right.
You can see this for yourself by adding the Xy-grid backdrop to your project.
https://projects.raspberrypi.org/en/projects/lost-in-space/print 7/21
1/26/23, 11:02 AM Lost in space
https://projects.raspberrypi.org/en/projects/lost-in-space/print 8/21
1/26/23, 11:02 AM Lost in space
Another way to animate the spaceship is to tell it to move a small amount many times
Delete the glide block from your code. To do this, drag the block off the Code area and drop it back
where the other single code blocks are.
when clicked
point in direction 0
go to x: -150 y: -150
glide 1 secs to x: 0 y: 0
https://projects.raspberrypi.org/en/projects/lost-in-space/print 9/21
1/26/23, 11:02 AM Lost in space
Now use a repeat block to move your spaceship towards the Earth.
when clicked
point in direction 0
go to x: -150 y: -150
repeat 200
move 2 steps
Test and save your code. Your spaceship should move towards the Earth exactly as before, but this time
it uses a repeat block.
https://projects.raspberrypi.org/en/projects/lost-in-space/print 10/21
1/26/23, 11:02 AM Lost in space
Next add code to your spaceship sprite so that the spaceship changes colour as it moves towards
Earth?
Use this block:
when clicked
point in direction 0
go to x: -150 y: -150
repeat 200
move 2 steps
https://projects.raspberrypi.org/en/projects/lost-in-space/print 11/21
1/26/23, 11:02 AM Lost in space
Can you make your spaceship get smaller as it moves towards Earth?
I need a hint
Your code should look like this:
when clicked
point in direction 0
go to x: -150 y: -150
repeat 200
move 2 steps
Test and save your code. Your spaceship should now get smaller as it moves. Test your spaceship a second time.
Is it the right size when it starts?
https://projects.raspberrypi.org/en/projects/lost-in-space/print 12/21
1/26/23, 11:02 AM Lost in space
https://projects.raspberrypi.org/en/projects/lost-in-space/print 13/21
1/26/23, 11:02 AM Lost in space
Now you will add a monkey who’s lost in space to your animation!
Click on your new monkey sprite and then click on Costumes so that you can edit how the monkey looks.
Set the fill to be transparent by selecting the red line. For the outline, set a white colour by moving the
Saturation slider to 0.
https://projects.raspberrypi.org/en/projects/lost-in-space/print 14/21
1/26/23, 11:02 AM Lost in space
Click on the circle tool and then use it to draw a white space helmet around the monkey’s head.
Can you add code to your monkey sprite so that it spins slowly in a circle forever?
I need a hint
Here’s the code to make your monkey spin:
when clicked
forever
turn 1 degrees
Test and save your project. You’ll have to click on the red stop button to end this animation, as it runs forever!
https://projects.raspberrypi.org/en/projects/lost-in-space/print 15/21
1/26/23, 11:02 AM Lost in space
https://projects.raspberrypi.org/en/projects/lost-in-space/print 16/21
1/26/23, 11:02 AM Lost in space
Can you add code for your rock sprite so that the rock bounces around the stage?
I need a hint
Here’s the code for making your rock bounce around the stage:
when clicked
forever
move 2 steps
if on edge, bounce
https://projects.raspberrypi.org/en/projects/lost-in-space/print 17/21
1/26/23, 11:02 AM Lost in space
https://projects.raspberrypi.org/en/projects/lost-in-space/print 18/21
1/26/23, 11:02 AM Lost in space
Can you add code to your star sprite to make the star repeatedly grow and shrink?
I need a hint
Here’s the code to make your star grow and shrink:
when clicked
forever
repeat 20
change size by 2
repeat 20
change size by -2
https://projects.raspberrypi.org/en/projects/lost-in-space/print 19/21
1/26/23, 11:02 AM Lost in space
Challenge!
https://projects.raspberrypi.org/en/projects/lost-in-space/print 20/21
1/26/23, 11:02 AM Lost in space
https://projects.raspberrypi.org/en/projects/lost-in-space/print 21/21