Health stuff

Non-platform specific questions.

Health stuff

Postby bkelynch » Sun Mar 05, 2006 2:39 pm

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)
bkelynch
 
Posts: 73
Joined: Sun Dec 04, 2005 7:48 pm
Score: 0 Give a positive score

Postby Troodon » Sun Mar 05, 2006 3:59 pm

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.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby bkelynch » Tue Mar 07, 2006 9:16 pm

The code doesnt work. Insted, it wont let me raise or lower the health.
It just keeps it at 000
bkelynch
 
Posts: 73
Joined: Sun Dec 04, 2005 7:48 pm
Score: 0 Give a positive score

Postby DilloDude » Wed Mar 08, 2006 1:13 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby bkelynch » Wed Mar 08, 2006 9:18 pm

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
bkelynch
 
Posts: 73
Joined: Sun Dec 04, 2005 7:48 pm
Score: 0 Give a positive score

Postby DilloDude » Wed Mar 08, 2006 11:48 pm

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby bkelynch » Wed Mar 15, 2006 12:30 am

It still doesnt work
bkelynch
 
Posts: 73
Joined: Sun Dec 04, 2005 7:48 pm
Score: 0 Give a positive score

Postby frodo » Wed Mar 29, 2006 4:00 pm

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.
User avatar
frodo
 
Posts: 127
Joined: Tue Mar 21, 2006 6:53 pm
Location: universe
Score: 2 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest