Announcement

User registrations are currently disabled due to high spam traffic.

#1 16/06/08 4:00pm

mental_atom
Regular Member
Registered: 11/06/08
Posts: 64
Website

Health help

can someone please tell me why this code does not work and correct it?

Code:

if(_root.life = 0);
_root.gotoAndStop(7);
}
}

what it is is that when my person hits something its health goes down. I have ut this on the scene so that when the health (called life) reaches 0 it goes to frame 7


[img]http://i25.tinypic.com/n4wlcm.jpg[/img]

Offline

 

#2 16/06/08 5:15pm

Zuriki
Flash Dev (The Lazy One)
From: Manchester
Registered: 18/01/08
Posts: 755
Website

Re: Health help

Check the PDC topic.


[img]http://img134.imageshack.us/img134/9129/headerxt2.png[/img]
[url=http://zuriki.co.nr/project/traveller/][img]http://i28.tinypic.com/2vspafo.png[/img][/url]
[url=http://zuriki.co.nr]Zuriki - PSP Flash Games[/url]

Offline

 

#3 16/06/08 6:55pm

69corvette
That one guy.
From: Not Palmdale, CA
Registered: 01/02/08
Posts: 281

Re: Health help

Code:

if(_root.life == 0);
_root.gotoAndStop(7);
}
}

You need a "==" instead of "=".
"=" is a modifier, whereas "==" is the equality operator.

In fact though,  you might want to use "<=" in case life goes below zero.


[img]http://img221.imageshack.us/img221/8990/smallersigcopylb1.jpg[/img]

Offline

 

#4 16/06/08 8:31pm

mental_atom
Regular Member
Registered: 11/06/08
Posts: 64
Website

Re: Health help

ok i understand why now too


[img]http://i25.tinypic.com/n4wlcm.jpg[/img]

Offline

 

#5 18/06/08 5:40pm

Dezerith
Moderator of Doom.
Registered: 27/07/07
Posts: 196
Website

Re: Health help

And you never opened the commands in the if... so with the enterFrame it would be:

Code:

onClipEvent(enterFrame){
if(_root.life == 0){
_root.gotoAndStop(7);
}
}

[img]http://i26.tinypic.com/28iys08.jpg[/img]
[img]http://www.resiststorage.org/images/blazebytedev53.png[/img]
[img]http://www.resiststorage.org/images/PSPflashForDezBzeByteDev4.png[/img]

Offline

 

#6 18/06/08 6:42pm

mental_atom
Regular Member
Registered: 11/06/08
Posts: 64
Website

Re: Health help

thanks guys


[img]http://i25.tinypic.com/n4wlcm.jpg[/img]

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson