- Home /
Question by
MoizSafdar · Aug 29, 2016 at 09:24 AM ·
collisionmultipleenemieskill
Fire to the multiple Enemies For 5 to 6 times
When I have Multiple Enemies.So when I shoot at one of them that number should decrease.But here's my problem: The first enemy dies round about 3 shots to it, but when I start to shoot at the other (after the first enemy), it takes 1 shot and dies.
Here is the enemykill Code
var health = 100; var life = 50;
function OnCollisionEnter(boom : Collision) {
if(boom.gameObject.tag == "bullet")
{
health -= life;
if(health <= 0)
Destroy(gameObject);
}
}
Please Guys help me and thnks in advance....!!!!
Comment
Your answer
Follow this Question
Related Questions
Colliding with multiple objects to destroy other gameObject 4 Answers
Trouble with apply damage to enemy 2 Answers
Why does OnCollisionStay returns multiple contact points in such a strange way? 0 Answers
multiple collisions to Destroy (gameObject); 1 Answer
Lag on Collision from Projectile 1 Answer