Monsters LR, UD

Monsters Left/right

Obj: monsterLR

Create a new object monster LR - set it to the blue ghost "monster 1" (not "monster_nice"; we'll use those later for facing directions).

  • Create
    • Move Fixed - left and right, speed "6" (a bit slower than our player) or "8" (same speed as our player = more challenging)
  • Collision with wall
    • Reverse Horizontal

Room

In your testing room, delete everything in your room that we've already tested. Add some walls down the middle with a hole, and put your person there. Add some horizontal walls on both sides as shown below. Then add 2 monster LRs in your room.

Test it out - do they move left & right, and reverse direction when they hit a wall?


Monsters: Up/Down

Obj: monsterUD

The easiest thing is to duplicate your monsterLR object....

Change the name to monster UD, change it to the green "monster 2" sprite. 

  • in Create event, change Move directions to the up and down arrows
  • in Collision with wall event, delete the action and replace with Reverse Vertical

Room

Add 2 monster UDs to your room as shown below. 

Test it out.

Losing Lives

Obj: person

Go into your person object and the following:

  • Collision with monsterLR
    • Play Sound (dead)
    • Sleep
    • Set Lives - lose a life (make sure it's relative or else you hit one monster and the game will be over, you'll have less than 0 lives!)
    • Jump to Start 

Duplicate this event for the Collision with monsterUD... (it's the same, you don't have to change anything).

Your person should now look like this...

Test your game - if you run into a monster, do you "die" (pause/sound, person where started)? If yes, continue.