Person moving

arrow keys

Obj: person

Create a new object person with the bear sprite.

Add the <Left> Keyboard event...

Add the following actions:

  • Check Grid (32x32)
  • Move Fixed: left, speed 8

We need to complete the other direction events. Duplicate the event to create the following events and just change the move action...

  • <Right> event...

Double-click on the Move action and change the arrow/direction.

  • Duplicate...<Up> event... and change the direction/arrow to up.
  • Duplicate...<Down> event... change direction/arrow to down.

Stop Moving

when collides with a wall

We also need to make sure the person stops moving properly (if the player is not holding down any keys, or if the player hits a wall).

  • Collision with wall 
    • Check Grid (32x32)
    • Move Fixed: center, speed 0

when no key pressed

Duplicate the Collision with wall event...

Set it to <No Key> 

So your person looks like this so far. When the player is not tapping an arrow key, the person should stop moving.

Room

Add the person object somewhere in the room. 

Now test out your game (F5), making sure the person...

  • moves properly with the arrow keys
  • doesn't move when you have no keys pressed
  • doesn't go through walls
  • doesn't get stuck

If everything's good, keep going.