-
Just a quikc gotoAndPlay() question.
Can gotoAndPlay() be used in if statements?
see code below:
Code:
if(_root.shields == 0){
gotoAndPlay("GAMEOVER", 1);
}
The reason i ask is because the code i posted above doesnt send my game to the scene GAMEOVER? and i dont have a clue why ive tracked shields to make sure they do reach 0 which they do but it doesnt send the game to the scene specified?
any ideas?
-------------------------------
One who will rise from the ashes!
-------------------------------
-*Phoenix*-
-
Senior Member
Yes they can. Try using this.
if(_root.shields == 0){
trace("Game over")
gotoAndPlay("GAMEOVER", 1);
}
That code will make a message appear in the output panel saying 'Game Over' if the shields variable equals 0. If you do not get a message, then its another problem. If you do get the message, try calling the first frame on the scene 'GAMEOVER'
Also, Its case sensitive.
-
Senior Member
OOh yeah, have you tried
_root.gotoAndPlay("GAMEOVER",1)
-
Ok ive tried that i do get the message so the variable is being read at 0 but it still doesnt change scene?
-------------------------------
One who will rise from the ashes!
-------------------------------
-*Phoenix*-
-
And yes i have tried _root. as well that doesnt seem to do anything either?
-------------------------------
One who will rise from the ashes!
-------------------------------
-*Phoenix*-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|