From 097e88de617d40992bf139d7e62ba0c5ffeb65dc Mon Sep 17 00:00:00 2001 From: Arfa Amer Butt <buttaa3@mcmaster.ca> Date: Wed, 16 Nov 2016 23:33:09 -0500 Subject: [PATCH] Fixed the paddle moving out of the frame issue --- Game_Code/src/startGame/GameController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Game_Code/src/startGame/GameController.java b/Game_Code/src/startGame/GameController.java index 3c35020..203c5c0 100644 --- a/Game_Code/src/startGame/GameController.java +++ b/Game_Code/src/startGame/GameController.java @@ -119,7 +119,7 @@ public class GameController{ padWidth = paddle_player.getWidth(); // Obtain paddle dimensions padHeight = paddle_player.getHeight(); inset = paddle_player.getInset(); - bottomPadX = frameWidth / 2 - padWidth / 2; + bottomPadX = frameWidth /2 - padWidth /2; topPadX = bottomPadX; paddle_player.setPositionX(bottomPadX); paddle_player.setPositionY(bottomPadY); @@ -454,7 +454,7 @@ public class GameController{ } } else if (keys.contains("RIGHT")) { - if(bottomPadX < frameWidth - padWidth){ + if(bottomPadX < frameWidth - 2.75*padWidth){ /** * If the user presses RIGHT * - update the position of the user paddle @@ -475,7 +475,7 @@ public class GameController{ */ double delta = ballX - topPadX; if (delta > 0) { // If the AI paddle is trying to reach the right wall - if(topPadX < frameWidth - padWidth){ + if(topPadX < frameWidth - 2.75*padWidth){ /** * - Move the paddle to the right * - Display the movement on the screen @@ -599,7 +599,7 @@ public class GameController{ -System.out.println(timeElapsed); + System.out.println(timeElapsed); } private void resetGame(){ -- GitLab