Have the Screen call remove() on all Entities before removing them.

This commit is contained in:
Jan Philipp Timme 2014-11-04 20:23:21 +01:00
parent a91a60381c
commit 95f3e05fed

View File

@ -95,6 +95,10 @@ public abstract class Screen {
*/
public void cleanup() {
if(this.overlay != null) this.overlay.cleanup();
//tell all entities to cleanup themselves.
for(Entity e : this.getEntities()) {
e.remove();
}
this.entities.removeAll(this.entities);
}