To avoid monsters from falling off platforms, we introduce another object, which we call a marker. This marker will be an invisible blue block. Whenever a monster touches it, it
reverses its direction of motion.
Create a new object monster. Set to the right facing monster sprite.
Start with a Create event and set it to Move to the right at speed 4.
When the monster hits a block, it needs to reverse horizontal direction.
Add a Collision with marker event and set it to reverse direction. You can just duplicate the previous event.
To have the monster facing the right direction, we need the End Step event. This event happens just before the instances are drawn. In it we set the correct sprite
based on the the horizontal speed. If it is larger than 0 we let the monster face right and otherwise we let it face left.
-
Test Variable: if hspeed > 0
- If it is, then Change Sprite to monsterR
-
Else
-
Change Sprite to monsterL
Test it out. If they work, keep going...