Step 3: Move Up

Goal:


We are creating a type of game called a 2D (2 Dimensional) game. 2D games can be of any game genre with any kind of game play you can imagine, but they all share one major thing in common. The way you can move in them. In our game, you can only move in 4 direction, Up, Down, Left, and Right.

We need to program a way for the player to press a specific button and for the X-Wing to move in a predictable direction.

Let’s start with the X-Wing’s up movement (positive y direction).

Steps:

  1. From Control, place an IF statement block inside of the forever block.
  2. From Sensing, place a key space pressed block.
  3. Click on the triangle next to “space” to open up the menu and select the up arrow.
  4. From Motion, place a change y by block.
  5. From Variables, place a round speed block into the change y by block.

Code:


Click to replay