I've built a simple flash game which simply requires the user to navigate the mouse cursor around a maze from a start position to one of four ending positions based on their chosen answer from a multiple choice question.
I would like to incorporate a method of scoring into the game. This is my code so far, the scoring system doesn't work as when the user hits the wall or gets the answer wrong they are directed to another frame which presents them with a "incorrect" screen and allows them to click a button which says retry. The retry button brings them back to the main frame which ultimately resets the score to 0. How would I go about passing variables to other frames if possible?
import flash.events.Event;
import flash.net.*;
var isStart = false;
var score:Number = 0;
mc_wall.addEventListener(MouseEvent.MOUSE_OVER,overWall);
function overWall(e:Event) {
if (isStart == true){
gotoAndStop(5);
score -= -2;
}
}
mc_start.addEventListener(MouseEvent.MOUSE_OVER,overStart);
function overStart(e:Event) {
isStart = true;
}
mc_blue.addEventListener(MouseEvent.MOUSE_OVER,overBlue);
function overBlue(e:Event) {
if (isStart == true){
gotoAndStop(4);
score += 10;
isStart = false;
}
}
mc_red.addEventListener(MouseEvent.MOUSE_OVER,overRed);
function overRed(e:Event) {
if (isStart == true){
gotoAndStop(6);
score -= -2;
isStart = false;
}
}
mc_green.addEventListener(MouseEvent.MOUSE_OVER,overGreen);
function overGreen(e:Event) {
if (isStart == true){
gotoAndStop(6);
score -= -2;
isStart = false;
}
}
mc_yellow.addEventListener(MouseEvent.MOUSE_OVER,overYellow);
function overYellow(e:Event) {
if (isStart == true){
gotoAndStop(6);
score -= -2;
isStart = false;
}
}
Any help would be greatly appreciated