The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.34 / 5.00 31,296 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 10,082 ViewsHello
I have a script that, when my moviclip hits the walls, it subtracts 1 from the amount of lives that the player has.
In the beginning, when the game starts, the player has 3 lives.
So far, everything works fine.
But now i would like a script, so that when the amount of lives is 0, it goes to another frame which sais you lost.
This is the current code i am using, but it doesnt work:
if(_root.lives==0){
gotoAndStop(2)
}
The dynamic text box has the var name of "lives".
Can someone please point out to me what exactly am i doing wrong?
Thanks in advance
crayzrocker
Does no one know how to do this???
Sorry for the double post...
Can you try taking away _root and post how that works out?
Gamemaker in Training.
At 12/3/08 07:54 AM, Trunks-Lock wrote: Can you try taking away _root and post how that works out?
Nope, still does not work.
Help?
I think I found the problem.
if(_root.lives==0){
gotoAndStop(2)
}
You missed an ; behind gotoAndStop(2).
So it should be:
if(_root.lives==0){
gotoAndStop(2);
}
Gamemaker in Training.
Alright, here's an example of what I used ( year old stuff so AS2 ) :
if(body>0)
{
body-=5;
}
else
{
disableObjects();
gotoAndStop(3);
}
There's a timer around it, so it checks every frame if body > 0.
But this works for me.
Gamemaker in Training.
If you're putting that on the main timeline, it won't work because it'll only check it once (when the game first starts). What you want is:
onEnterFrame = function () {
if(_root.lives==0){
_root.gotoAndStop(2);
}
} "Whoever said 'winners never quit' obviously never considered addicts." - Hoeloe