Let’s use the arrow keys to fly your helicopter.
Let’s start by coding your helicopter to move up when the up arrow is pressed.
Test your code and you’ll see that your helicopter’s y
position (up/down) changes whenever the up arrow is pressed.
To have your helicopter move more smoothly, you can instead add code to move upwards inside your helicopter’s forever
loop.
You can also code your helicopter to move to the left when the left arrow is pressed. This time you’ll need to change the helicopter’s x
postition by -5
.
Now code your helicopter to respond to the down and right arrow keys.