Keeping Score with Dynamic Text + If

I’m trying to create a game for a class project, using Flash MX. Unfortunatly, I am unable to figure out how to goto a new scene when the score reaches a certain number.

The ActionScript for it is…:
//hit
_root.total = _root.total + 100
//miss
_root.total = _root.total - 50

I’ve tried…


if (_target.score >= “100”
gotoAndStop("Scene 2, “1”)
}else (_target.score <= “-100”
gotoAndStop("Scene 2, “2”)


if (this.score >= “100”
gotoAndStop("Scene 2, “1”)
}else (this.score <= “-100”
gotoAndStop("Scene 2, “2”)


if (score >= “100”
gotoAndStop("Scene 2, “1”)
}else (score <= “-100”
gotoAndStop("Scene 2, “2”)


I’ve even tried using “”'s around ‘score’ and other things, but still no luck. I still havn’t figured out the stupid timer either…

If anyone can give some advice, I’d apreciate it greatly!

Thanks

you dont need "'s around the 100. But you need it around the scene number. See if this works:

[AS]
if (_root.score>=100) {
gotoAndPlay(“Scene 2”, 1);
}
if (_root.score<=-100) {
gotoAndPlay(“Scene 2”, 2);
}
[/AS]

that should work, but i havn’t tested it. Tell me if it does or doesn’t :slight_smile:

No luck with that either – Thanks for trying though.

Today I’ve also tried a few other things with no luck…

Winner = (_root.score >= 100)
Loser = (_root.score <= -100)

if (winner) {
gotoAndStop (“Win”, “1”);
}else if (loser)
gotoAndStop (“Lose”, “1”);
}

X >= 100
Y <= -100

if (_root.score = X) {
gotoAndStop (“Win”, “1”);
}else if (_root.score = Y) {
gotoAndStop (“Lose”, “1”);
}

… I’m beginning to think it isn’t possible.

Can i have a look at your fla?

in the meantime try this:

[AS]
if (_root.score>=100) {
_root.gotoAndPlay(“Scene 2”, 1);
}
if (_root.score<=-100) {
_root.gotoAndPlay(“Scene 2”, 2);
}
[/AS]

Thinking about it… I can just make the score manually. And have a miss move the score (movie clip), move to a previous frame.

Thanks a lot for the suggestions though.