PDA

View Full Version : About keeping Score in a game.


cdrake
08-12-2004, 11:08 PM
I use this code to keep score

on (release) {
_root.score = _root.score+10;
}
on (release) {
if (_root.score==100) {
gotoAndStop(72);
}
}


I have it on the movie clip, so when you click it it ads 100 points to the total. Right now, when you get to 100 it automatically goes to the you win frame.

I have a timer set on 1 minute because the movie loops. When the timer runs out it takes you to a you lose page. How do I make it where it doesnt automatically take you to the you win page but waits until the timer runs out and then tells you whether you have enough points or not?

Ive tried this but it doesnt seem to work


else{
this.sec ="00";
this.counterOutput ="00";
{
if (_root.score==100) {
gotoAndStop(2);
}
}


Whereas if the score doesnt equal 100 it takes you to fram 2. Can you change where it has == to > (greater than)

Thanks in advance,
Carey

curryjon51
08-13-2004, 12:43 PM
Hi

Something like the attachment should do it.... a setInterval adds one to a count variable untill it reaches 60... your minute. Then depending on whether or not _root.score is higher than 100, it sends the _root.timeline to a win or lose frame.


hth