From 493f041908180140ccd9eb5c964e65fdceb59013 Mon Sep 17 00:00:00 2001 From: Muna Kandel <mkandel2@myune.edu.au> Date: Thu, 21 Sep 2023 22:29:44 +0545 Subject: [PATCH] Final Touches --- app/src/main/java/brickbreaker/GamePanel.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/brickbreaker/GamePanel.java b/app/src/main/java/brickbreaker/GamePanel.java index d9dfc07..c8c18c0 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); -- GitLab