How do I reset and start another game.
Hello
Please can someone help, I have spent several days on this and still can't get it to work.
The code below is ok, I am playing a bowling game using the keyboard and timer with a text readout of the elapsed time, the bowl moves a set number of pixels on the screen. whilst in full screen mode I would like to click a start/play button on the screen to start the game and timer again, everything is in frame 1. Also I would like the game to just accept the keycode 77 and keyboard event (2 events only to move the bowl) and then wait for the start/play button click.
Thanks
Mick
import flash.utils.Timer;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
var totalTime:Number = 0;
var startTime:Number;
//stop();
var bowlTimer:Timer = new Timer(1,6000);
//startButton.addEventListener(MouseEvent.CLICK, startTimer);
bowlTimer.addEventListener(TimerEvent.TIMER, moveBowl);
//bowlTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endTimer);
/*function startTimer(e:MouseEvent):void
{
clockTimer.start();
trace("Timer started");
startButton.visible = false;
}*/
function moveBowl(e:TimerEvent):void
{
myBowl.x = myBowl.x + 70;
trace("Timer cycle expired");
}
/*function endTimer(e:TimerEvent):void
{
trace("Timer finished");
}
*/
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
var myKeyBoolean = false;
function keyDownHandler(event:KeyboardEvent)
{
if (event.keyCode == 77)
{
bowlTimer.start();
startTime = getTimer();
}
else if (myKeyBoolean == false)
{
bowlTimer.stop();
totalTime +=(getTimer()-startTime)/1;
yourTF.text = Math.round(totalTime).toString();
}// add yourTF to the stage
}