How can I reset and start another game.

Hello

Please help someone, I spent several days on this and still can't make it work.

The code below is ok, I play a bowling game using the keyboard and the timer with a reading of the text of the passage of time, the bowl moves to a set number of pixels on the screen.  while I would, mode full screen click Start/play button on the screen to start the game and the timer, all is in box 1.  I also would like the game to simply accept the 77 keycode and keyboard event (2 events to move the bowl) and wait for the boot/play button click.

Thank you

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 expired cycle");
}

/ * function endTimer(e:TimerEvent):void
{
trace ("Timer complete");
}
*/
stage.addEventListener (KeyboardEvent.KEY_DOWN, keyDownHandler);

var myKeyBoolean = false;

function keyDownHandler(event:KeyboardEvent)
{

If (event.keyCode is 77)
{

bowlTimer.start ();
startTime = getTimer();

}
Else if (myKeyBoolean == false)
{

bowlTimer.stop ();
totalTime += (getTimer () - startTime) / 1;

yourTF.text = Math.round (totalTime) m:System.NET.SocketAddress.ToString ();
} / / Add a yourTF to the stage

}

While he must wait to find out if someone is also a solution based on code that will slip into what you now have, is one of the easiest ways to make reset build your design in box 2, maintaining Framework 1 devoid of any objects/code controlled (graphics just to avoid a white Flash), and when you want to reset you use gotoAndPlay (1).  Who should return to the initial conditions all around.

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • Problem saving files

    When I record, I get the following error: result code = - 34 I have no idea why or how remedy. Thank you

  • Rectangle to the right of the screen

    When I insert a web page, it sometimes loads a blank rectangle on the right side of the page. Can't all the time, but often enough that it's pretty boring. Thought it might try to load an image or something since it's always the same shape and locati

  • How to stop mobile broadcasting

    I couldn't stop mobile broadcast

  • Contact Hotmail customer service

    Dear customer, My hotmail account has been blocked temporarily. Someone might have used my account to send a lot of unwanted messages. Can I know how to contact customer service to unlock my hotmail account? Please notify. Thank you very much Mimi030

  • Windows Media Player-how add a new video of the House to my playlist

    I have a few Playlists.  I would now like to add several new videos to a playlist, but I couldn't do it.  Help, please.