Step 8: Ship Up Movement

Goal:


Let’s begin coding the ship’s movement in the game.

We need to code the ship to move up when we press the ‘w’ key.

Up on the computer is a change in the positive y direction.

Steps:

  1. From Control, place an IF block.
  2. From Sensing, place a key block in the IF block.
  3. Set the key to ‘w.’
  4. From Motion, place a change y by block and set it to 3.

Code: