diff --git a/app/src/main/java/brickbreaker/GamePanel.java b/app/src/main/java/brickbreaker/GamePanel.java index d9dfc07fe7707c050dbae52b37e859736c8d9cde..c8c18c049a47986c007640eaa7ef6a4d85b794a6 100644 --- a/app/src/main/java/brickbreaker/GamePanel.java +++ b/app/src/main/java/brickbreaker/GamePanel.java @@ -147,8 +147,9 @@ public class GamePanel extends JPanel implements KeyListener, ActionListener { for (int k=0; k<noOfBallsToSpawn; k++) { boolean positiveXDirection = Math.random() > 0.5; boolean positiveYDirection = Math.random() > 0.5; - int dirX = (positiveXDirection)? 1: -1; - int dirY = (positiveYDirection)? 1: -1; + int powerUpSpeed = 3; + int dirX = (positiveXDirection)? powerUpSpeed: -powerUpSpeed; + int dirY = (positiveYDirection)? powerUpSpeed: -powerUpSpeed; Color color = Color.GRAY; Ball newBall = new Ball(brickPosition.x, brickPosition.y, dirX, dirY, ball.radius, color); newBallsToAdd.add(newBall);