PDA

View Full Version : Keeping Score with Dynamic Text + If



Llama Lord
April 14th, 2003, 10:15 AM
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

blah-de-blah
April 14th, 2003, 10:31 AM
you dont need "'s around the 100. But you need it around the scene number. See if this works:


if (_root.score>=100) {
gotoAndPlay("Scene 2", 1);
}
if (_root.score<=-100) {
gotoAndPlay("Scene 2", 2);
}


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

Llama Lord
April 15th, 2003, 07:54 AM
No luck with that either -- Thanks for trying though.

Llama Lord
April 15th, 2003, 08:39 AM
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.

blah-de-blah
April 15th, 2003, 10:07 AM
Can i have a look at your fla?

in the meantime try this:


if (_root.score>=100) {
_root.gotoAndPlay("Scene 2", 1);
}
if (_root.score<=-100) {
_root.gotoAndPlay("Scene 2", 2);
}

Llama Lord
April 16th, 2003, 10:29 AM
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.