Question about health.

Talk about making games.

Question about health.

Postby The achievement » Wed Sep 13, 2006 7:48 pm

Okay, im not doing any ancy health bar im just doing a number life bar. So anyway, i have collision on any side of my enemy and make it so the health goes - 15. so my problem is that if i hit the enemy it goes - 14, not to 75. how do i fix this? and i wanna do an if on zero. but anyway heres what im doing.
Code: Select all
 life.textNumber = life.textNumber - 15;



when the life gets to zero can i do, if (life) = <0; Destroy Actor ("player");
I am the only Zombie Genocider.
User avatar
The achievement
 
Posts: 220
Joined: Sun Feb 12, 2006 11:01 pm
Location: United States,Massachusetts
Score: 0 Give a positive score

Postby makslane » Wed Sep 13, 2006 8:13 pm

On 'Create Actor' event of your life actor, put

Code: Select all
textNumber = 100;


And the right test condition is:

Code: Select all
if (life.textNumber =< 0) DestroyActor("player");
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Game A Gogo » Wed Sep 13, 2006 10:36 pm

[quote="makslane"]
Code: Select all
if (life.textNumber =< 0) DestroyActor("player");
[/quote
what is that "=" is doing there??
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby makslane » Wed Sep 13, 2006 10:44 pm

Ops...
Use <= or <
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron