Page 1 of 1

Help with enemy health

PostPosted: Tue Dec 26, 2006 10:25 pm
by Griffin Endurance
Hi

I have been working on a game in GE that use's the create actor feature to create multiple actors with the same property and i am at a bit of a loss. I would like to set it so if you weapon actor collides with one of the enemys 3 times it kills it. Im trying to do this within the enemy actors propertys so i can use the event actor bit so they dont all die. If anyones got any ideas i would be very greatful

PostPosted: Tue Dec 26, 2006 11:03 pm
by Sgt. Sparky
I have a very simple Idea that should work, to do this easily. at the draw actor event of the enemy have this
Code: Select all
if (transp > .009)DestroyActor("EventActor");
and when the weapon collides with the enemy have this for the enemy
Code: Select all
 transp += .003;

and that should kill the enemy after 3 hits, to make a less amount of hits to do more damage increase the transp on the hit to a higher number :D
to kill in one hit have this on the collision
Code: Select all
 transp += 0.009;

I hope this helps :D :D :D

PostPosted: Wed Dec 27, 2006 11:37 am
by Griffin Endurance
Thanls that works great! thanks for the help

PostPosted: Tue Jan 02, 2007 3:42 pm
by Sgt. Sparky
you are welcome! I used that for one of my games :D
Image
as you see the game is not that good so I did not finish it :D

PostPosted: Tue Jan 02, 2007 10:29 pm
by Game A Gogo
yeah, but this technique can change the transparency a little bit, and its not recommended to use on already partially transparent actor.
create an variable insted and change transp for the variable you created.

PostPosted: Tue Jan 02, 2007 11:26 pm
by irblinx
Isn't there a performance hit when using transparency settings?

Personally I'd use a local variable with the actor, each time your weapon hits the actor you could decrement the variable, once the variable reaches zero destroy the actor.

In the Actors "Create Actor" event
Code: Select all
actorLives = 3;


then in the collision event with the weapon;

Code: Select all
if (actorLives > 0){
   actorLives --;
}
else{
   DestroyActor("EventActor");
}

PostPosted: Wed Jan 03, 2007 12:34 am
by Game A Gogo
yes, transparency's affect game performance on slow machines a lot (I know! by experiance!)