Step 1: Movement Code

Goal:


Let’s start by making Iron Man’s starting code. Events are messages broadcasted throughout your game that trigger lines of code specified by the user.

The “reset_game” event will be used to return everything back to the way the game is supposed to begin.

“Motion” blocks will be used to properly place sprites in the proper locations and control the behavior of their movement using coordinates.

Steps:

  1. From Events drag a When I receive block to an empty space.
  2. Select message1 in the event block and click on “New Message.
  3. Name this event “reset_game.
  4. From Motion, drag a Go to x/y block and a point in direction 90 block under the event.
  5. Make sure x is set to -110 and y is set to 0.

Code:


Click to replay