This is how I currently clean up dead objects.
It’s not a good way of doing so and must change.
During the game objects die, their hit points are at or below 0.
I’ve read many ways of achieving this goal but my current situation would mean I have to implement “isDead()” checks throughout my scripts and collision code.
Any alternative fast way of removing dead entities?
`
private transient Player pc;
private ArrayList characters;
private ArrayList scripts;
/*Clean up the dead/
public void cleanUpDeadObjects()
{
for(Iterator i = characters.iterator(); i.hasNext()
{
GameCharacter character = (GameCharacter)i.next();
if(character.isDead())
{
J2DRenderQ.getInstance().remove(character);
i.remove();
}
}
}
`