hi, im trying to create a timer for my flash game. i need it so that after 60 seconds if the score is over 200 it takes you to the frame gameWon and if its under 200 to take you too frame gameLost.
im having problems with making the timer show up and for the code to actually take you to another frame
i would be so grateful if you could look at my code and tell me where i have gone wrong
thank you
stop();
var score:Number=0;
addEventListener(Event.ENTER_FRAME,testHit);
function testHit(e:Event){
if (kissBoy.hitTestObject(kissGirl)){
trace(“Hit”);
score+=5;
scoreDisplay.text=“score:”+score
}
}
function reached60Seconds():void {
if (score>200) {
gotoAndStop(“gameWon”);
} else {
gotoAndStop(“gameLost”);
}
}
var myTimer:Timer=new Timer(60000,1);
myTimer.addEventListener(TimerEvent.TIMER,reached60Seconds);
myTimer.start();
function theAction(event:TimerEvent):void{
trace(“TimerTriggered”);
}
function runalltime(evt:Event):void{
if (kissBoy.hitTestPoint(kissGirl.x,kissGirl.y,true)){
kissGirl.x=Math.random()*400;
kissGirl.y=Math.random()*300;
}
}
function keydetect(evt:KeyboardEvent):void{
if(evt.keyCode==Keyboard.RIGHT){
kissBoy.x+=10;
}
if(evt.keyCode==Keyboard.LEFT){
kissBoy.x-=10;
}
if(evt.keyCode==Keyboard.UP){
kissBoy.y-=10;
}
if(evt.keyCode==Keyboard.DOWN){
kissBoy.y+=10;
}
}
stage.addEventListener(Event.ENTER_FRAME,runalltime);
stage.addEventListener(KeyboardEvent.KEY_DOWN,keydetect);
thanks x