Level 3 - Monsters


The game as it stands now starts looking nice, but is still completely trivial, and hence boring to play. So we need to add some action in the form of monsters




Create three different monsters: one that moves left and right, one that moves up and down, and one that moves in four directions. Each monster should have different images for each way it moves.






Adding the Monsters

Adding a monster is actually very simple. It is an object that starts moving and changes its direction whenever it hits a wall. When the person hits a monster, it is killed, the level is restarted and the player looses a life. Give the person three lives to start with.


First create the monster that moves left and right. It will start moving on create.


When a collision occurs it reverses its horizontal direction.

To Change the sprite we check if we are moving left (hspeed < 0) or moving right (hspeed >0)

The second monster works exactly the same way but this time we start moving either up or down, when we hit a wall, we reverse the vertical direction. On the end step we check vspeed and change the image


The third monster is slightly more complicated. It starts moving either in a horizontal or in a vertical direction on Create

When it hits a wall it looks whether it can make a left or a right turn. If both fail it reverses its direction. This looks as follows:




To check if the spot in front of monster is empty (If position is collision free)


If you want to make your movement more random try adding two lines at the top of your ENDSTEP......


To Change your subimage add Change Sprite to your End Step



To avoid problems with monsters being slightly too small, uncheck precise collision checking and modify the mask to set the bounding box to the full image.


When the person collides with a monster, we have to make some awful sound, sleep a while, decrease the number of lives by one, and then restart the room. (Note that this order is crucial. Once we restart the room, the further actions are no longer executed.) The controller object, in the "no more lives" event, shows the high-score list, and restarts the game.








Now that our game is geting more difficult we should probably add lives.


In the intro screen/first room add a obj_setlives

In your obj_draw object from level 2 draw the lives
You can also add a no more lives check here