Use the bouncing-ball animation techniques to create a Block Breaker game with a) A bouncing ball (a

Question:

Use the bouncing-ball animation techniques to create a Block Breaker game with

a) A bouncing ball (a Circle),

b) Several rows and columns of blocks (Rectangles) in red, yellow, blue or green (randomly selected for each block), and

c) A paddle (another Rectangle) at the bottom of the app.

When the app begins executing, the ball is sitting on top of the paddle, which is located at the bottom-center of the window. The user clicks the mouse to set the ball in motion toward the blocks—that is, its dy value is initially negative. When the ball hits a block, that block should be removed from the screen and the ball should bounce back towards the blocker—that is, its dy value becomes positive, similar to bouncing off the top of the Pane. If the ball hits the left or right side of the Pane it should bounce in the opposite direction.

To move the ball toward the blocks again, the user must move the paddle (by moving the mouse left or right in the window) so the ball will bounce off the paddle to change directions. The dx value should change only when the ball hits the Pane’s left or right side. For this version of the app, set the dx and dy values to 2. You can test for collisions between the ball and the blocks or paddle by using the Shape class’s static intersect method.

The user should begin with three lives—if the ball misses the paddle and falls off the bottom of the screen, the user should lose a life. The game ends when the user either clears all the blocks or loses all three lives. Award points for each block that’s destroyed with more points for blocks in the higher rows.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: