First make a spaceship that can defend the Earth!
Open the ‘Clone wars’ Scratch starter project.
Online: open the starter project at clone-wars-on.
Add this code to the spaceship sprite to make the spaceship move left if the left arrow is pressed:
The x-axis goes from the left side of the Stage to the right side. This means that the spaceship moves to the left when you subtract from the value of the spaceship sprite’s x
position. So this code block is the part that makes your spaceship move left:
Add some more code inside the forever
block to make your spaceship move to the right if the right arrow key is pressed.
Test your project by clicking the green flag. Can you press the arrow keys to make your spaceship move left and right?