How to make a maze game




Making a maze game
Insert two additional layers, so you are left with 3 layers. Name layer 1 maze, layer 2 cursor and layer 3 actions.
Right click on the first frame in the actions layer and select actions, add the following actions:
stop();
Mouse.hide();
cursor.onMouseMove = function() {
this._x=_xmouse, this._y=_ymouse;
};

These actions have been explained in previous tutorials.

In the first frame of the cursor layer, using the oval tool, draw out a small circle on the stage. Now convert the circle into a movie clip, call it cursor. Also give it an instance name of cursor.
Now on the first frame of the maze layer, select line tool and set the stroke height to 10.75 or higher. Now draw out your maze(this is what the cursor will have to be guided through so make sure the cursor is smaller enough to fit in your maze).
Convert the maze you just made into a button. Now right click on the maze, select actions, and add these actions to it:
on (rollOver) {
gotoAndStop(2);
}

This means that if the cursor rolls over the maze it will move on the 2nd frame.
Now at the end of the maze where you want the finish to be draw our something that represents the end of the maze. Eg. You may want to put a trophy or a gold medal or something like that.
Convert it into a button and add the following actions to it:
on (rollOver) {
gotoAndStop(3);
}

These actions are the same as before only with a different frame number to go to.

Now insert a new keyframe at frame 2(this is the frame that the game will go to if the cursor rolls over the maze). Now delete everything on the stage, and using the brush tool, write something like YOU LOSE. Now insert another keyframe at frame 3 in the maze layer. Delete the YOU LOSE text and replace it with something like GREAT WORK.
That’s it, you just made a maze game, you may want to insert keyframe at frames 2 and 3 of the cursor layer so the cursor is still active.
Now that you know how to create a maze game, add more levels, with the knowledge you have learnt throughout these tutorials you will be able to add button to restart and buttons to go to the next level etc.

1 comment:

Anonymous said...

i just start learn flash, but not for game, maybe some kind for web and portfolio.. hope next posting you will sharing about it..
i will try it to make some exercise
thanks for sharing this nice article