PDA

View Full Version : how do u make a "reaction time" timer like in FwyWarrior's Create a ride v2?


djcharliewarlie
10-27-2002, 11:09 PM
has anybody played that game
its on newgrounds and iwas wondereing if sumone could tell me how to do a timer-like thing where after u see a green light, u have to click a button and it tells u how many thousanths/hundreths/tenths/etc. of a second it took u to click the button

:confused:

jimburton
10-28-2002, 09:36 AM
Do it with getTimer:

function startTimer() {
lightMC.gotoAndStop("green");
var started = getTimer();
}
function stopTimer() {
lightMC.gotoAndStop("red");
var stopped = getTimer();
var timeTaken = stopped-started;
trace ("you took "+timeTaken/1000+"seconds to click me");
}

and then a button within lightMC that has the code:

on(release) {
_root.stopTimer();
}

djcharliewarlie
10-28-2002, 09:08 PM
thanx man!