diff --git a/core/src/com/me/brickbuster/entity/Ball.java b/core/src/com/me/brickbuster/entity/Ball.java index 0e817f6..828a2c7 100644 --- a/core/src/com/me/brickbuster/entity/Ball.java +++ b/core/src/com/me/brickbuster/entity/Ball.java @@ -154,17 +154,13 @@ public class Ball extends Entity implements PhysicsBody, CollisionListener { @Override public void setX(float x) { super.setX(x); - Vector2 bodyPos = body.getPosition(); - bodyPos.x = x; - body.setTransform(bodyPos, 0); + body.setTransform(pos, 0); } @Override public void setY(float y) { super.setY(y); - Vector2 bodyPos = body.getPosition(); - bodyPos.y = y; - body.setTransform(bodyPos, 0); + body.setTransform(pos, 0); } public void setSpeed(float speed) { diff --git a/core/src/com/me/brickbuster/entity/Brick.java b/core/src/com/me/brickbuster/entity/Brick.java index 7afad97..9a18384 100644 --- a/core/src/com/me/brickbuster/entity/Brick.java +++ b/core/src/com/me/brickbuster/entity/Brick.java @@ -45,8 +45,8 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener { this.shape = shape; this.powerUpType = powerUpType; this.pm = new Pixmap(1,1, Pixmap.Format.RGBA8888); - pm.setColor(type.getColor()); - pm.fill(); + this.pm.setColor(type.getColor()); + this.pm.fill(); this.solid = new Texture(pm); this.region = new TextureRegion(solid); createBody(); @@ -196,6 +196,18 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener { public void endContact(Entity contacted) { } + @Override + public void setX(float x) { + super.setX(x); + body.setTransform(pos, 0); + } + + @Override + public void setY(float y) { + super.setY(y); + body.setTransform(pos, 0); + } + @Override public void dispose() { solid.dispose(); diff --git a/core/src/com/me/brickbuster/entity/Paddle.java b/core/src/com/me/brickbuster/entity/Paddle.java index 75d24a0..d3266fe 100644 --- a/core/src/com/me/brickbuster/entity/Paddle.java +++ b/core/src/com/me/brickbuster/entity/Paddle.java @@ -107,17 +107,13 @@ public class Paddle extends Entity implements PhysicsBody { @Override public void setX(float x) { super.setX(x); - Vector2 bodyPos = body.getPosition(); - bodyPos.x = x; - body.setTransform(bodyPos, 0); + body.setTransform(pos, 0); } @Override public void setY(float y) { super.setY(y); - Vector2 bodyPos = body.getPosition(); - bodyPos.y = y; - body.setTransform(bodyPos, 0); + body.setTransform(pos, 0); } public float getWidth() {