Page 1 of 1

creating enemy health for a bunch of enemy clones

PostPosted: Wed Feb 15, 2006 3:47 am
by supaboy86
Hey sorry that I could not reply, I just got my internet back. This is what previously happened.

Supaboy86
am making a Metroid Prime type game and I don't know how to kill an enemy by shooting it by a certain number of times. Need serious help!

Make an actor integer varable called enemyHealth.
On create enemy enemyHealth=5;
On enemy collision with bullet enemyHealth--;
On draw enemy
Code:
if (enemyHealth<=0) DestroyActor("Event Actor");

Later you can just create clones of this enemy and every one will have its own health. If any of these terms are unclear check out the tutorials, the forum search or GE documentation, but feel free to ask any questions thats why we are here. Hope this helps.
_________________

Here is the problem. I don't know about variables, Integers or anything dealing with a global code!! please help me to make my dream game come true by solving my one problem. Thank you :)

PostPosted: Wed Feb 15, 2006 4:19 pm
by Troodon
You don't need the global code. (I think)
Go to actor->create actor->script editor:
1.make a variable by clicking the 'variables' button.
2.write
Code: Select all
theVariableYouMade = 3;

Put in the place of 3 the times you must hit the actor.
3.Go to shotActor->collision (any side of actor)->script editor:
4.write
Code: Select all
theVariableYouMade = theVariableYouMade - 1;

5.go to actor->draw actor->script editor:
6.write
Code: Select all
if (theVariableYouMade <=0) DestroyActor("Event Actor");


I hope this helped :wink:

Thank you so much!!!!!

PostPosted: Wed Feb 15, 2006 8:14 pm
by supaboy86
:D I have been trying to accomplish that forever!!!! Many many thanks.
I hope that people that have this same problem will read this subject.