Use instance bodies array
This commit is contained in:
parent
adebc42c16
commit
9eac3353b6
@ -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<Body>();
|
||||
|
||||
|
||||
// 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<Body> bodies = new Array<Body>();
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user