Home

Home

 Print This Lesson


SCRATCH TUTORIAL     SPACE SHUTTLE MISSION STS-2020
Lesson 5     Create Scripts for Shuttle Controls

  • Description. Use the arrow keys to move the Shuttle from side to side, and up and down.

    If you haven't already, Launch the Scratch program from your desktop.
  • Let's get started!!!

  • We will be using the freedom background. Click on the Stage icon, Select the freedombg.
To get to the Shuttle sprite interface, in the Sprite list, Click on Shuttle icon

  • Script to move the Shuttle to the left.
Click on

Grab this block and drag it into the script area.






Click on the arrow and then click on left arrow to select the left arrow key to move the Shuttle.










Click on

Grab this block and drag it into the script area. Snap it to the control block

Click inside the circle and change the number to -1.

The x coordinate is side to side, horizontal to move the shuttle we have to subtract.
The Shuttle's starting coordinates are x:181 y:-131. As long as the left arrow key is pressed we subtract -1 from the x coordinate and the Shuttle moves to the left.

Test it

TIP: With this control block you do not have to doubleclick it to test. It is always on waiting for you to press the key.

Press the left arrow key to test.



Notice, when you reach the edge of the stage, part of the Shuttle goes pass the edge.

Let's tell it what to do when it touches the edge.

Grab this block and drag it into the script area. Snap it to the stack.



Now when the shuttle touches the edge it will bounce.

Test it

To make the Shuttle move faster, change the number. Try -5

  • Script to move the Shuttle to the right.



We don't have to drag the blocks, since our blocks will be the same we can copy the stack.

Place your mouse pointer over the top block in the stack and right click. then click duplicate.

Move the new stack and click to drop it.














On the contol block select right arrow.

To move to the left, we had to subtract from the x coordinate.

To move to the right we have to add to the x coordinate.

change x by 1.

Test it




  • Script to move the Shuttle up.
To move the Shuttle up and down or vertical, we have to change the y coordinate.
To move it up we have to add to the y coordinate

Since only 1 block changes, we can duplicate a stack.

Move the mouse pointer over the top block in the stack and duplicate

Grab the bottom block in the stack and drag to break the stack. Same with the next block.

Grab and drag this block   back to the script block area or place the mouse pointer over it and right click and then click delete.

Grab this block from the Script Block area and drop it in the Script area.

Drag and snap the blocks back together.

On the control block select up arrow

On this block Change the number to 1

Test it and

  • Script to move the Shuttle down.
To move the Shuttle up and down or vertical, we have to change the y coordinate.
To move it down we have to subtract form the y coordinate

Move the mouse pointer over the top block in the up stack and duplicate

On the control block select down arrow

On this block   Change the number to -1
Test it and

  • Clean up the Script Area.


If your Script Area gets messy, block stacks not lined up.

Move the mouse pointer to a clear place on the Script area. Right click then click Clean up







  • Update Notes.
In the top right corner, click on the notepad
I put this in mine:

Shuttle Controls:  Use the arrow keys to move the Shuttle.