diff --git a/core/src/com/me/brickbuster/state/PlayState.java b/core/src/com/me/brickbuster/state/PlayState.java index f0e3dcc..9e68fad 100644 --- a/core/src/com/me/brickbuster/state/PlayState.java +++ b/core/src/com/me/brickbuster/state/PlayState.java @@ -61,6 +61,8 @@ public class PlayState extends State { // Initialize a world with no gravity world = new World(new Vector2(), false); world.setContactListener(new Box2dContactListener()); + bodies = new Array(); + // define a playArea body with position set to 0 BodyDef playAreaDef = new BodyDef(); @@ -117,7 +119,6 @@ public class PlayState extends State { @Override public void render() { - Array bodies = new Array(); world.getBodies(bodies); for (Body b : bodies) { Entity e = (Entity) b.getUserData(); @@ -207,9 +208,10 @@ public class PlayState extends State { @Override public void dispose() { super.dispose(); - world.dispose(); + bodies.clear(); + powerUps.clear(); powerUps = null; balls.clear();