-
[BETA][PROBLEM]Cannot get lives variable to function properly!
I'm trying to make it so in my game, when variable lives < 0, it goes to frame three.
http://img235.exs.cx/my.php?loc=img2...terspace8o.swf
(Arrow keys, space to fire, and 700 score=1 life)
I've tried many things, such as
if (_root.lives<0){
gotoAndPlay(3)
}
if(_root.lives<0){
gotoAndPlay("gameover")
}
if(lives==-1)
gotoAndPlay(3)
}
And many other combinations, but it JUST doesn't work!
Can someone PLEASE help me very soon?
-
my x booty it is that BIG
replace this
code:
if (_root.lives<0){
gotoAndPlay(3)
}
if(_root.lives<0){
gotoAndPlay("gameover")
}
if(lives==-1)
gotoAndPlay(3)
}
with this
code:
if (_root.lives<=0){
gotoAndPlay(3)
}
if(_root.lives<=0){
gotoAndPlay("gameover")
}
and if frame 3 is the same frame as the gameover frame
code:
if (_root.lives<=0){
gotoAndPlay(3)
}
Project||[GAME]-on hold for now
------------------
[Hero]-80%
[Enemies]-1%
[Weapons]-90%
[Items]-0%
[Levels]-10%
-
Yes, I tried that and it still doesn't work. I'm wondering if I should put it in another MC, I put it on the tank one.
EDIT: I just put it on the ballon MCs, no difference.
I'm really lost here...
Last edited by [username here]; 03-13-2005 at 12:10 AM.
-
*bump* (I'm sorry, but I just have to get this done in a certain time frame, very tight).
-
Style Through Simplicity
What are you trying to send to frame 3? are you sending the character to a death animation or are you sending the _root to a game over screen. if your doing that then use
code:
if (_root.lives<0) {
_root.gotoAndStop(3)
}
Otherwise im not sure. are you sure the lives variable is on the _root?
Ali
-
I've tried that to no avail. It seems it sees frame 1 as frame three, becuase when lives<0, it goes to frame 1. And I've checked everything on frame three to make sure there are no "play" commands to make it go to frame 1.
-
I just did _root.play() instead of _root.gotoAndPlay and I got it to work. I still don't know why the hell it didn't work, though.
-
Style Through Simplicity
Well do you have a stop() command? There is no reason why the code shouldnt work.
Are you sure your changing the lives variable at all? you might just be changing the text display. try putting
code:
if (_root.lives <0) {
trace (_root.lives)
}
if that doesnt work then the lives variable isnt working.
Ali
[edit]
didnt see last post
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
|