Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timed game

Status
Not open for further replies.

struth

Programmer
Aug 26, 2001
114
GB
Got a simple memory game that I want kids to complete in say five minutes or else _root.bigfoot squishes them. Just can't seem to get the get timer() thing working.

Can anyone help?

TIA
Struth
 
Hard to say without seeing your code!
Post it or make your .fla available!

Regards,
mywink2.gif
ldnewbie
 
Have a look at this and see what you think. This is on an off stage MC:

onClipEvent (enterFrame) {
if (_root.delay) {
if (Math.floor(getTimer()/1000) == _root.lastTime+1) {
}
} else if (Math.floor(getTimer()/1000) == _root.lastTime+_root.wait) {
_root.lastTime = Math.floor(getTimer()/1000);
_root.delay = true;
tellTarget ("_root.bigfoot") {
play ();
}
}
}

Plus an action on the root

_root.wait = 300;
 
I might be missing something subtle here but isn't the first "if" statement redundant?

An easy timer script for five minutes would be to set up the end time as soon as the game starts and then use your clip event to check the time as the game progresses. So...

on(release){
_root.endTime=getTimer();
_root.endTime+=300000;
}


...would be attached to the start button (or equivalent function) and the checking could be done by something like...

onClipEvent(enterFrame){
currentTime=getTimer();
if (currentTime>=_root.endTime){
_root.bigfoot.gotoAndPlay(1);
}
}


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top