Page 1 of 1

Health stuff

PostPosted: Sun Mar 05, 2006 2:39 pm
by bkelynch
OK, i know how to lower heath when collision with the enemy, and I know how to higher heath when collision with the health peice. I just need to know how to destroy the player actor when the heath is at 000 (I'm using a text actor as my health)

PostPosted: Sun Mar 05, 2006 3:59 pm
by Troodon
Put in the actor's draw actor:
Code: Select all
if (textActor.textNumber = 000)
{
destroyactor (actor);
}


:roll: I'm not so sure of that destroyactor event but you can search it from the list in the script editor.

PostPosted: Tue Mar 07, 2006 9:16 pm
by bkelynch
The code doesnt work. Insted, it wont let me raise or lower the health.
It just keeps it at 000

PostPosted: Wed Mar 08, 2006 1:13 am
by DilloDude
You need to have
Code: Select all
if (textActor.textNumber == 000)

Use a single = when you want to set a variable. Use a double (==) when you want to compare to expressions.

PostPosted: Wed Mar 08, 2006 9:18 pm
by bkelynch
The code works, but every time i open the game, the text is at 000, even if i type in 001 or add 1 when the actor is created

PostPosted: Wed Mar 08, 2006 11:48 pm
by DilloDude
Make a variable, Health. On your collisions etc. say Health-=10. ON the text actor's draw actor event, textNumber=Health, if Health <= 0, DestroyActor("Player"). On create actor, Health = 100.

PostPosted: Wed Mar 15, 2006 12:30 am
by bkelynch
It still doesnt work

PostPosted: Wed Mar 29, 2006 4:00 pm
by frodo
I had trouble with that before, but I think I can help.

Make a variable "health".
in create actor do: health =10;
you can make your health amount any amount.
then on collision on any side of bullet(or whatever makes you health go down) type:

health=health-1;

draw actor

if(health<000)
{
health=0;
destroy actor("event actor"):
}

hope that helped.