Hi

I am trying to create a simple(ish) maze game. I have the basics of the character staying in the maze area and getting him to the finish. Now I want to put some icons in the maze which the character has to rollover (collect) before he can complete the level.

So basically I presume I have to create a variable starting at 0 and increases by one when you rollover the icon. When you reach the desired number then you can exit the maze, not before.

Here is the code I have on the character:

//
// CHARACTER VARIABLES FOR SPEED AND SIZE.
//
onClipEvent (load) {
// Speed which you will move round the maze.
speed = 10;
// Size of the character so it stays in the maze.
radius = 15;
}

//
// CONTROL WHAT THE CHARACTER DOES.
//
onClipEvent (enterFrame) {

// MOVE THE CHARACTER USING ARROW KEYS
// Move Left.
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
// Move Right.
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
// Move Up.
if (Key.isDown(Key.UP)) {
_y -= speed;
}
// Move Down.
if (Key.isDown(Key.DOWN)) {
_y += speed;
}

// KEEP THE CHARACTER INSIDE THE WALLS.
while (_root.maze_mc.hitTest (_x, _y + radius, true)) {
_y --;
}
while (_root.maze_mc.hitTest (_x, _y - radius, true)) {
_y ++;
}
while (_root.maze_mc.hitTest (_x - radius, _y, true)) {
_x ++;
}
while (_root.maze_mc.hitTest (_x + radius, _y, true)) {
_x --;
}

// WHEN YOU REACH THE END OF THE MAZE
if ((_root.finishLine.hitTest(_x, _y + radius, true)) or (_root.finishLine.hitTest(_x, _y - radius, true)) or (_root.finishLine.hitTest(_x - radius, _y, true)) or (_root.finishLine.hitTest(_x + radius, _y, true))) {
trace ("Maze Complete");
}
}

Here is the code I have on the icon:

//
// DETECT TO SEE IF THE CHARACTER IS OVER THE HIT AREA.
//
onClipEvent (enterFrame) {
if (this.hitTest (this._parent.character_mc)) {

// The Character is in the Hit Area.
trace ("Character in Hit Icon 01");

} else {
trace ("");
}
}



Can anyone help on how this can be done. If anymore information is needed please let me know.

Thanks