- Home /
Multiple enemies not working
Hi
I have made a enemy that can deal damage to the player and eventually kill him. The enemy is working really good. But I am wondering how I can make a fool-proof script so I can deal damage to the enemy (NOTE: This is not a game with guns, I am using ranged damage. If the enemy is withing the range and I press "hit" then it deals damage). It works when I have a single enemy, but it doesn't work with multiple enemies. So how can I make a script that supports multiple enemies?
Answer by Posly · Dec 11, 2011 at 02:38 PM
I'd make something like
Function OnCollisionEnter( hit : collision) { If(hit.gameobject.name = "(name of enemy here without parenthesis)" { (script that does damage goes here) } }
I'm a novice scripter but I think this will work.
Your answer
Follow this Question
Related Questions
Animation position changes when used on multiple objects.,Enemy attack animation position changes 1 Answer
Trouble with apply damage to enemy 2 Answers
Fire to the multiple Enemies For 5 to 6 times 0 Answers
how do i kill multiple enemies? 0 Answers
multiple enemies does nt work with this script but a a single enemy works..Please help 0 Answers