Scratch Silver III
Scratch Silver II
SCRATCH SILVER I
SCRATCH GOLD III
1 of 3

1.02 Control the rover

In this step, you will use an on-screen controller or the keyboard to move your rover up and down.

Open the starter project online at nature-rover-starter.

You should see a scene with a robotic rover, a hilly background, and a controller in the bottom, left-hand corner.

The staring background showing hills, a pile of mud, and a robot.

You are going to use the controller or keyboard controls to make the rover look as if it is moving towards or away from the viewer.

Look at the Code tab for each of the buttons. The code will look something like this:

The up sprite.

This keeps the buttons in the correct position, and broadcasts their directions when they are clicked.

The rover is going to control the start of the game for all the other sprites; so when the green flag is clicked, the rover sprite needs to broadcast a start message.

Add the broadcast to a green flag clicked block.

The rover sprite.

If you are working on a computer, it might be easier to use the keyboard controls, rather than using the buttons. Keyboard controls can be added to the rover sprite.

If you don’t want to use the controller, then click on each of the button sprites and click on the hide block in the looks
menu.

When the up button is clicked or the up arrow is pressed, the rover should change its y position by a small amount. Increasing y will make the rover move up. Decreasing y will make the rover move down.

Add code so the up button makes the rover move up.

You don’t need to worry about the left and right motion yet. Left and right motion will be added in the next step of the project.

Add perspective to your rover by making it smaller when it moves upwards, and larger when it moves downwards.

You’ll need to reset the rover’s size at the start of the game.

Test: Click the up and down buttons to check the control of your rover, or use the arrow keys.

Now reset the position of the rover each time the game starts.

For now, the rover should appear in front of the other sprites. Move the rover to the front layer.

Test: Click the green flag to test that your game resets correctly.

×
×

Cart