Question: For this assignment, you will create the game Breakout. If you do not know Breakout, it is a game with a bouncing ball, paddle and

 For this assignment, you will create the game Breakout. If you
do not know Breakout, it is a game with a bouncing ball,
paddle and a series of bricks. The object is to hit the
ball with the paddle so that it bounces to the other end

For this assignment, you will create the game Breakout. If you do not know Breakout, it is a game with a bouncing ball, paddle and a series of bricks. The object is to hit the ball with the paddle so that it bounces to the other end of the game field and hits one or more bricks. As each brick is hit, it disappears and the user scores points. If the user can clear the entire field of breaks, then the game resets with a new field of bricks. You may have already implemented a portion of this if you have done chapter 15 exercises 5 & 6. If you haven't look at my solution to see my code You should start with your own code though as you wil want to implement this in your own way How the game works . Have bx, by, bdx and bdy variables to represent the ball's location and velocity. The ball 2. Have px and pdx to represent the paddle's upper-left corner and its motion in the x . Have any array of Bricks. Bricks are defined below as a separate class (either a nested 4. Declare the following as instance data as they will be shared among various methods and is a Circle direction. The paddle does not move in the y direction. The paddle is a Rectangle. inner class or a class in a separate file, your choice). event handlers: a. Cirele ball-the ball (needed to add to and remove from the Pane as it moves) b. Rectangle paddle-the paddle (add and remove from Pane as it moves) c. int score, lives-player's current score and lives remaining d. Text description-output of the current score and number of lives remaining e. bx, by, bdx, bdy, px, pdx as noted above (used in several locations) f. the array of Bricks (this is a 2-D array g. the Pane and the Timeline object h. a Random generator 5. Your main method will call launch 6. Your start method will instantiate or initialize all of your instance data a. for the bal, set bx to the middle horizontally and by to a value beneath the Bricks but well above the paddle, give px a value in the middle horizontally, pdx should start at 0, bdx and bdy should be given random values as long as bdy is positive (so that initially, the b is moving downward), mit bdx, bdy, pdx to a reasonable range (say -3 to +3) b. create the Text, Circle and Rectangle objects and add them to the Pane; also draw four Lines to have borders around the playing field c. instantiate all of the Brick objects and for each Brick object, pass it the Pane object Brick l contact a draw method that will draw a Brick onto the Pane (described below) d. create a Timeline object with its own event handler (described in 7) and attach to the Scene a Key EventHandler (described in 8), use a reasonable duration (mine was 15, if you have a larger number, you will bdx/bdy and pdx) want to allow larger ranges t e. set the timer to repeat indefinitely and start animation, add the pane to the scene and the scene to the stage, show the stage

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!