Have the Screen call remove() on all Entities before removing them.
This commit is contained in:
parent
a91a60381c
commit
95f3e05fed
@ -95,6 +95,10 @@ public abstract class Screen {
|
|||||||
*/
|
*/
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
if(this.overlay != null) this.overlay.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);
|
this.entities.removeAll(this.entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user