public class Defender
extends java.lang.Object
Constructor and Description |
---|
Defender(int startX,
int startY,
java.lang.String imageName)
Constructs a Defender at the given location with the given image
|
Modifier and Type | Method and Description |
---|---|
Laser |
fireWeapon()
Return the bullet this Defender is about to fire.
|
int |
getHitPoints()
Returns the number of hit points for this Defender.
|
java.lang.String |
getImageName()
Returns the filename of this Defender's image
|
int |
getXPosition()
Get the current x coordinate of the center of this Defender.
|
int |
getYPosition()
Get the current y coordinate of the center of this Defender.
|
boolean |
isHitByLaser(Laser theLaser)
Returns whether this Defender intersects this Laser
|
void |
paint(java.awt.Graphics g)
Paint this Defender onto the given Graphics object
|
void |
recordHit()
Updates the Object to record that it has been hit by a Laser.
|
boolean |
removeMeFromGame()
Returns true if this Defender is dead.
|
void |
setHitPoints(int hitPoints)
Set the number of hit points for this Defender.
|
void |
setXPosition(int newXPosition)
Sets the x position to the given position
|
public Defender(int startX, int startY, java.lang.String imageName)
startX
- the x position to start atstartY
- the y position to start atimageName
- the filename for the image to usepublic void setHitPoints(int hitPoints)
hitPoints
- The new number of hitPointspublic int getHitPoints()
public void setXPosition(int newXPosition)
newXPosition
- The x position of this Defenderpublic Laser fireWeapon()
public java.lang.String getImageName()
public int getXPosition()
public int getYPosition()
public boolean isHitByLaser(Laser theLaser)
theLaser
- The laser to check position against.public boolean removeMeFromGame()
public void recordHit()
public void paint(java.awt.Graphics g)
g
- the Graphics object to draw onto