Page 1 of 1

Soldier march

PostPosted: Wed Jun 10, 2009 11:40 am
by savvy
games controls are:
up-jump
down-duck
left & right to move
space-shoot

'how can i get he enemies to die after a certain amount of shots?

Re: Soldier march

PostPosted: Wed Jun 10, 2009 12:26 pm
by DST
Make an integer variable, actor variable, named health;

enemy>collision>any side>shot>
Code: Select all
health-=1;
if(health<=0){  //if damage can be more than one, then health can go from 1 to negative numbers,
                       //so we use <= 0 instead of ==0.
DestroyActor("Event Actor");
}


Also, your direction for your shots is changing with player direction; make sure the shots only set their direction on CreateActor, and never again after that.

Re: Soldier march

PostPosted: Thu Jun 11, 2009 4:41 am
by Bee-Ant
DST wrote:
Code: Select all
health-=1;
if(health<=0){  //if damage can be more than one, then health can go from 1 to negative numbers,
                       //so we use <= 0 instead of ==0.
DestroyActor("Event Actor");
}

Through this way, your enemy would die when their HP is 1.

Use this instead...(if you want your enemy die when the HP is 0)
Code: Select all
if(health<=0){  //if damage can be more than one, then health can go from 1 to negative numbers,
                       //so we use <= 0 instead of ==0.
DestroyActor("Event Actor");
}
health-=1;

Re: Soldier march

PostPosted: Fri Jun 12, 2009 11:54 am
by savvy
Ok, ive posted the updated version now anyway.

Re: Soldier march

PostPosted: Thu Jun 20, 2013 12:52 am
by Grynde
Would the enemy's initial health be set in the draw actor command?

Edit*
After I d/l Sgt. Sparky's demo (viewtopic.php?f=6&t=5397) I figured it out.