PDA

View Full Version : Game "Time Delay" after question is answered


kunafish
07-29-2002, 05:48 PM
newbie here,

- creating a "jeopardy" like game in Flash 5.

- need help on creating a 'time delay" (about 6 seconds) after the user answers a question (either correctly or incorrectly. the question box pops up, user answers, end result is visible for 6 seconds, then fades out)

- i have my main stage. A mc placed on the main stage contains the question/answer box. I would like to have, say, an action that occurs when the user click on the answer (or question in this jeopardy game). When the person reaches a particular frame (in this mc) , a counter starts, going up to 6 seconds, then proceeds onto closing the mc (or fading it out, whatever).

something to the effect of:

pause=6*1000
...... (something goes here .... I don't know what though)

if(getTimer() > pause) {
gotoAndPlay (22);
}

what do I do here?

i know getTimer() has something to do with it. i understand that it counts from when the main movie starts. I want it to start counting when the person hits, say, frame 18.

i've checked out the tutorial, but it has everything occuring on the main stage. I want mine occuring in the movie clip. i've tried, but have just gone mad.

if anyone can point me in the right direction, i'd appreciate it!

chanx

Grifter
07-29-2002, 08:04 PM
you need to set a variable that is equal to the time that the user answers the question.

//on a button for answering the question
on(release){
_root.answered = getTimer();
}

//on a movieclip
onClipEvent(load){
_root.pause = 6 * 1000;
_root.answered = //INSERT REALLY HIGH NUMBER HERE - i think you can use Math.Max or something but can't remember if that's the proper name
}

onClipEvent(enterFrame){
if(getTimer() > (_root.answered + _root.pause)){
gotoAndPlay(22); // or whatever you want to do here
}
}



and that should do the trick (i think).

Regards
Grifter