Description
Due: Monday Oct 21 by the end of the day. (your
midterm is later that week)
Project:
You will write a program which will demonstrate inheritance using some simple
classes which might form the backend of a 2d game with bit more work.
Implement the UML found below along with a few extra methods found in the
details below the UML:

Methods:
The methods in the UML class diagram above should be implemented as follows:
- GameEntity Class
- doesCollide: should return true if the rect for this
one overlaps the rect for the other GameEntity (hint: see the java.awt.Rectangle documentation for a
method to do this for you)
- takeDamange: reduces health by amount
- toString should print out the entity and its health
- Player
- add A constructor (not in the UML above). The
constructor should read from a file
- a set (at least 4) of weapon
names and damage values. Store this in an instance variable whose name
you select (it is not in the diagram so you can choose your own name and
type. Make sure that I can add a new weapon/damage combo and your code
will still work for all of them.
- start with the usual file
loading code - then to help you out consider the following:
- take a look at the String split
method
- to convert to a number you
can try Integer.parseInt
- swapWeapon:
- display the weapon names that
you loaded in the constructor and let the user pick one. Then set weapon
damage to the damage value for that weapon.
- changeArmor: should set armor to newArmorValue
- getArmor: should return armor
- attack : should call takeDamage on the enemy
- takeDamage: should reduce the damage by (armor/1000)
percent and then call the parent class takeDamage
- toString: standard toString then call parent class
toString
- Bad_Guy:
- attackClose should call takeDamage on victim passing
closeUpDamage as the parameter
- attackFromFar should call takeDamage on victim passing
distanceDamage as the parameter
- the Constructor should initialize the two instance
variables to some int between 100 and 200 of your choice
- Boss