Level 1 - Simple Maze
In this level the player simply must reach the exit.
There are three crucial ingredients in the game: the player, the walls, and the exit. Use your drawings from the previous section.
Design a simple maze (this is the easy level) using the walls from the previous section.
Use the character and goal sprite that you designed. Also the tutorial characters must appear somewhere in the maze.
Note: To slow down your animated walls
- add a create event to the wall
- add the following code in a code action
Use the sprites you created in the previous section and name them spr_person, spr_wall, spr_wall2, etc. and spr_goal. You may make additional non-animated walls if you choose.
Create the appropriate objects
obj_wall - solid The wall object does not do anything else. So no events need to be defined for it.
obj_goal – non-solid
When the person collides with the object we need to go to the next room. So we put this action in this collision event. First check if the next room exists. If not end the game.
Finally we need to create the person that is controlled by the player. We will use the arrow keys for movement.
We must always make sure the character is aligned to the grid, when it moves
In the control tab there is an action to test whether the object instance is aligned with a grid. Only if this is the case the next action is executed. We add it to each arrow key event and set the parameters to 32 because that is the grid size in our maze:
Complete each of the arrow keys using the actions below
Add a collision with the wall and a no key event
Setting Object Sub-Image
Note: Image tiles are numbered starting with 0.
We set the speed to 0 so that the character does not automatically animate.
Set Starting Image on Create
Set other images on Keyboard Event
Note: If your character gets stuck on walls re-align it to the grid
Note: If you created individual sprites just choose the appropriate sprite using the drop down menu.