Finding your way through a maze is a simple form of puzzle. In the previous post (“A Two Room Maze Game“) we looked at adding extra rooms to a maze game to provide a variety of different challenges to the player. In this post, we shall see how the introduction of an element of danger – in the form of “monsters” that can kill your player character – can spice up your game.
To begin with, we shall create a monster that just moves horizontally, from side to side, so that it can patrol a particular area of the the maze.
Create a new sprite –
spr_horMonster for example – and load it with an appropriate image. Use this sprite with a new object –
obj_horMonster, for example.
Configure the object as follows:
- Add a Create event to the monster object that triggers a Move action, choosing either left or right directions (or both!) and setting the speed slightly faster than that of the player character.
- Add a Collision event to the monster object that will cause the monster to bounce when it collides with a wall object.
- When the player bumps into the monster, the player character should scream out loud, the game will display a message, and the game should come to an end.
- For the scream, create a new sound, name it appropriately, and load in an appropriate sound file. In the player object, add an event that detects a collision with the monster object. For the first action, play the scream. The second action should display a message – such as “The monster caught you!”.
- Finally, add the End Game action to stop the game.
Place one or more monsters in the room and try out your game.
Is it a little bit more exciting now? More challenging, maybe? If necessary, modify the layout of walls within the room to provide runs for your monsters.
Experiment with the placement and speed of the monster(s) and see how it affects the difficulty of the game and your enjoyment of it. Do any particular configurations work particularly well? If you have a blog, why not take a screenshot or two to show the initial set up, and post them to your blog explaining why the configuration is effective.
[I use Jing to capture the screenshots used in this blog - Jing]
Duplicate the monster object and modify it so that it implements a monster type that moves vertically instead of horizontally (so you could maybe call this monster object
obj_verMonster. (You will need to modify the start action so the monster starts to move in a vertical, rather than horizontal direction.)
Add one or more of these monsters to your room and try out the game now. How do you need to modify the player object so that the vertically moving monsters (as well as the horizontally moving monsters) are capable of “attacking” the player character? Are there any particular ways of placing the wall objects and monsters to provide challenging situations for your player character to negotiate?