What is the best way to make several characters from the same class disappear? I spawn the "enemies" and then they run towards a barrel, this barrel explodes. After the explosion, only one of several enemies dies because the code I wrote only affect one. So what is the best way of killing several enemies that interact with an image width?
This is the code I have now.
Enemy mon = (Enemy)getOneIntersectingObject(Enemy.class); if(mon != null && this != null && getWorld() != null && animationVaribleExplode>=4) { getWorld().removeObject(this); mon.health-=10; mon.hit(10); }