In my Space shooter game there is an explosion code that when the rocket explodes any nearbyy objects are also exploded. My problem is that I had to create an actor class for the stars so I could move them, and they explode aswell, exploding everything. Is there a way to make the star class invincible so they aren't affected by the explosion?
This is the coed for explosing others.
/**
* Explode all intersecting objects.
*/
private void explodeOthers()
{
List explodeEm = getIntersectingObjects(null);
Iterator i = explodeEm.iterator();
while(i.hasNext()) {
Actor a = (Actor) i.next();
if( ! (a instanceof Explosion)) {//dont explode other explosions
int x = a.getX();
int y = a.getY();
//Replace other objects with an explosion
getWorld().removeObject(a);
getWorld().addObject(new Explosion(), x, y);
}
}
}

