diff --git a/core/src/com/me/brickbuster/entity/Ball.java b/core/src/com/me/brickbuster/entity/Ball.java index be2fe4f..429730b 100644 --- a/core/src/com/me/brickbuster/entity/Ball.java +++ b/core/src/com/me/brickbuster/entity/Ball.java @@ -42,9 +42,9 @@ public class Ball extends Entity { Vector2 new_pos = getPos().cpy().add(direction.cpy().scl(speed * dt)); - boolean brick_collision = false; + boolean brickCollision = false; Iterator brickIterator = getBrickBuster().getBricks().iterator(); - while (!brick_collision && brickIterator.hasNext()) { + while (!brickCollision && brickIterator.hasNext()) { Brick brick = brickIterator.next(); Vector2[] vertices = brick.getVertices(); for(int i = 0; i < vertices.length; i++) { @@ -60,7 +60,7 @@ public class Ball extends Entity { speed = BOOST_SPEED; } Utils.reflect(direction, segment.nor()); - brick_collision = true; + brickCollision = true; break; } } @@ -103,6 +103,7 @@ public class Ball extends Entity { direction = paddleReflectAngle(); isStuck = false; } else { + // launch at random angle between 135 and 45 degrees float angle = MathUtils.random(MathUtils.PI/2) + MathUtils.PI/4; direction = new Vector2(MathUtils.cos(angle), MathUtils.sin(angle)); speed = DEFAULT_SPEED;