diff --git a/core/src/com/me/brickbuster/entity/Ball.java b/core/src/com/me/brickbuster/entity/Ball.java index 8f628e5..a46170e 100644 --- a/core/src/com/me/brickbuster/entity/Ball.java +++ b/core/src/com/me/brickbuster/entity/Ball.java @@ -30,7 +30,7 @@ public class Ball extends Entity implements PhysicsBody, CollisionListener { public Ball(PlayState state) { super(state, state.paddle.getX(), state.paddle.getY() + Paddle.PADDLE_HEIGHT + RADIUS); - this.speed = state.bricks.size() > BLOCKS_FOR_BOOST? DEFAULT_SPEED : BOOST_SPEED; + this.speed = state.bricks.size > BLOCKS_FOR_BOOST? DEFAULT_SPEED : BOOST_SPEED; createBody(); } @@ -83,6 +83,7 @@ public class Ball extends Entity implements PhysicsBody, CollisionListener { ballFixture.shape = ballShape; ballFixture.restitution = 1f; ballFixture.friction = 0f; + ballFixture.density = 1f; body = state.world.createBody(ballBody); body.createFixture(ballFixture); diff --git a/core/src/com/me/brickbuster/entity/Brick.java b/core/src/com/me/brickbuster/entity/Brick.java index 74ea235..4dc18c4 100644 --- a/core/src/com/me/brickbuster/entity/Brick.java +++ b/core/src/com/me/brickbuster/entity/Brick.java @@ -3,6 +3,8 @@ package com.me.brickbuster.entity; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; +import com.badlogic.gdx.math.MathUtils; +import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.BodyDef; @@ -44,10 +46,11 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener { public void render(ShapeRenderer sr) { sr.begin(ShapeType.Filled); sr.setColor(color); - sr.rect(getX() * PlayState.PIXEL_PER_METER, - getY() * PlayState.PIXEL_PER_METER, - BRICK_WIDTH * PlayState.PIXEL_PER_METER, - BRICK_HEIGHT * PlayState.PIXEL_PER_METER); + sr.rect(pos.x * PlayState.PIXEL_PER_METER, pos.y * PlayState.PIXEL_PER_METER, + 0f, 0f, + BRICK_WIDTH * PlayState.PIXEL_PER_METER, BRICK_HEIGHT * PlayState.PIXEL_PER_METER, + 1f, 1f, + body.getAngle() * MathUtils.radiansToDegrees); sr.end(); } @@ -97,7 +100,7 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener { } public boolean hit() { - if (state.bricks.size()-1 <= Ball.BLOCKS_FOR_BOOST) { + if (state.bricks.size-1 <= Ball.BLOCKS_FOR_BOOST) { for (Ball ball : state.balls) { ball.setSpeed(Ball.BOOST_SPEED); } diff --git a/core/src/com/me/brickbuster/state/PlayState.java b/core/src/com/me/brickbuster/state/PlayState.java index 8ce6d62..9fff855 100644 --- a/core/src/com/me/brickbuster/state/PlayState.java +++ b/core/src/com/me/brickbuster/state/PlayState.java @@ -12,9 +12,7 @@ import com.me.brickbuster.entity.powerup.PowerUp; import com.me.brickbuster.entity.powerup.PowerUpType; import com.me.brickbuster.physics.Box2dContactListener; -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; public class PlayState extends State { @@ -42,11 +40,11 @@ public class PlayState extends State { public Body playArea; public Array
bodies; - public List