Question
The system shall have two GUIs (JFrames). The first GUI shall have two Jbuttons (Start and Restart) and a JSlider. The Start button shall be
The system shall have two GUIs (JFrames). The first GUI shall have two Jbuttons (Start and Restart) and a JSlider. The Start button shall be used to start the game. Once it's pressed the second GUI displays and the game starts. Once the game ends, the Restart button shall be used to start the game over. The JSlider shall be used for the player to select the game difficulty: Easy (4 bubbles), Medium (5 bubbles), Hard (6 bubbles).
The second GUI should contain the field where the game will be played. II. The Playing Field The playing field shall be defined as the dimensions of the JPanel. III. Reposition_Global For Round 1 The program shall prompt the user to define the origin for each bubble by clicking the mouse on the JPanel. If the user defines an origin that will result in a bubble not fully contained within the JPanel's dimensions, the program shall return an error and prompt the user to make another selection. Round 1 shall start as soon as the number of user selections equals the number of bubbles for the specified game difficulty.
For Rounds 2 - 10 Positions or repositions bubbles (circles) by choosing random coordinates from the entire playing field. A Java random number function/method shall be used for any operation that requires randomness. IV. Reposition_Local Repositions bubbles by choosing a random coordinate from each bubble's local neighborhood. The local neighborhood is defined as a subset of the playing field where the bubble is allowed to roam. For example, if a bubble's center coordinate is (100, 100) and we define a local neighborhood of 50, then the bubble can take a random hop in the bounding box (neighborhood) - (50,50), (50, 100), (100, 50), (100,100). Bubbles make hops in their local neighborhoods until they are burst. Bubbles are not allowed to hop outside of the playing field. The local neighborhood expands as the rounds increase. Assume a neighborhood of 50 for Round 1, and increase by 18 for each additional round.
V. Bubble Burst A bubble is burst once a player makes a mouse click inside any bubble (circle). Bubbles disappear once they are burst.
VI. Rounds A new round starts when all the bubbles are burst. New bubbles are then respawned using reposition_global. The round number shall be displayed.
VII. Game Over The game is declared over when the player clicks anywhere on the playing field, the player successfully completes 10 rounds, or the player takes too long to finish a round. A JOption shall appear once the game is over, and it shall display "Game Over."
VIII. Timer The timer starts at the beginning of each round. As the rounds increase, the time to complete each round decreases. The round 1 timer is 15 seconds, and it decreases by 1 second each additional round. The timer shall be displayed.
Step by Step Solution
3.49 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
This programming scenario involves creating a Java application with two graphical user interfaces GUIs for a bubblebursting game Lets break down the r...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started