Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

This game is only really feasible if you use a real-time Java Graphics library such as Processing. See the end of this file for more information about Processing. Write an object oriented game where...

1 answer below »
This game is only really feasible if you use a real-time Java Graphics li
ary such as
Processing. See the end of this file for more information about Processing.

Write an object oriented game where the player controls a Player entity to attempt to avoid
Projectile entities.

There should be an abstract class or interface Entity with at least the following:
- int x, int y to store the entity location
- abstract void draw() function to draw Entites to the screen
- abstract void update() function to update the position of entites
- and any other functions/data you want all entites to have

You should also have a Player class that extends/implements Entity, that draws the player in
some distinct way (such as a large circle) at its x,y position when draw() is called, and moves
the player (either with the mouse or keyboard) when update() is called.

And you should have a Projectile class that extends/implements Entity.
- Projectiles should spawn randomly from the edges of the window, and pose a threat to the
player.
- update should move a projectile in some way (such as in a circle, or a line)
- draw should draw the projectile in some way (such as a line or small circle)

Either the Player class or the Projectile class should contain a function to detect a collision
etween one projectile and the player. This can be as simple as a distance formula: d = sqrt(x*x
+ y*y). When the distance is less than or equal to the radius of the player's circle, there is a
collision.

For your main game loop, you should:
- Randomly spawn new projectiles. Your game should support multiple projectiles at once
- Update and draw all entities
- Check for collisions between the player and all projectiles
- On a collision, end the game in a way that the player would be able to tell the game ended

Your game should be free of easily detectable bugs/glitches like projectiles clearly moving
through the player without killing it, or projectiles killing the player without touching it. The
player should move smoothly and predictably. Your game should not crash with
IndexOutOfBounds or DivisionByZero or similar exceptions.

Extras (for your amusement, i.e. no extra credit):
- implement a scoring system to track the score of a game
- implement a way for a player to attack the projectiles
- implement a shield/lives system for the player
- implement several Projectile subclasses each with unique movement or other distinct features
- destroy projectiles that are no longer on screen

To learn Processing:

This tutorial covers how to draw ellipses at the mouse, so includes most the basic information
you might need: https:
processing.org/tutorials/gettingstarted/

The docs page is also quite important and useful: https:
processing.org
eference/
Answered Same Day Nov 22, 2021

Solution

Ayush answered on Dec 01 2021
154 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here