Create a game in java that gives the user a ship that they must navigate to dodge flying saucers. These flying saucers are of random size, speed and color.

All flying saucers (circles) begin at the top and are spaced across the screen. There are seven circles at a time. In the following picture the first two are still hidden behind the life bar for the game player.

Note: we start with three extra lives meaning the user has four lives total. see image.

Everytime a circle reaches the bottom of the page a new circle replaces it back at its top postion. The new circle will probably end up being a different size, speed and color since these attributes are chosen at random. If the user hits a ship he/she looses a life as shown in the following picture: see image.

If the user got hit two more times he/she would be on their last life and no spare lives would show at the top as in the following picture: see image.

When the user is hit for the last time the final ship will go away and a Game Over string should be drawn to the window and the flying saucers should continue to fall. Make sure you code it so that the ghost of your last ship is still not colliding with any of them. The following is a picture when the game is over: see image.

Important instructions:

Mr. Arnold is providing you with an example that listens for keys from the user. You should use this as the foundation for your project. Since you are going to have to redraw the ship in your paint method and since your game will have the focus and not the ship, it is best NOT to use the rectangle class for your ship. Simply draw a rectangle for each ship as it is done in the example provided. Since you will have multiple circles and they are not being interacted with via the keys you should use a modified version of our circle class from earlier in the semester. You will be responsible for the modification of that class.

Have fun with your project!

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.