Fixed issue where engine entities weren't cleared after exiting GameScreen

This commit is contained in:
Collin Smith 2019-05-02 22:02:55 -07:00
parent 801df645a3
commit 00c7a6c31a
2 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,12 @@ public class Engine implements Iterable<Entity> {
public Engine() {}
public void clear() {
entitiesById.clear();
entities.clear();
nextEntityId = 33;
}
public Entity getEntity(int id) {
return entitiesById.get(id);
}

View File

@ -749,6 +749,7 @@ public class GameScreen extends ScreenAdapter implements LoadingScreen.Loadable
@Override
public void dispose() {
Riiablo.engine.clear();
stage.dispose();
escapePanel.dispose();
controlPanel.dispose();