From 95f3e05fed876eefb0d6b5ac9ce119384d241fe6 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 4 Nov 2014 20:23:21 +0100 Subject: [PATCH] Have the Screen call remove() on all Entities before removing them. --- src/de/teamteamteam/spacescooter/screen/Screen.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/de/teamteamteam/spacescooter/screen/Screen.java b/src/de/teamteamteam/spacescooter/screen/Screen.java index fff29d5..02e213c 100644 --- a/src/de/teamteamteam/spacescooter/screen/Screen.java +++ b/src/de/teamteamteam/spacescooter/screen/Screen.java @@ -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); }