java.lang.Object UFO
public class UFO
A class representing a single UFO object that can move, fire, and be hit.
Field Summary | |
---|---|
static int |
FAST_SHIP
|
static int |
SIMPLE_SAUCER
|
static int |
SUPER_SAUCER
|
Constructor Summary | |
---|---|
UFO(int startX,
int startY,
int uFOType)
Constructs an UFO object given its type and initial position |
Method Summary | |
---|---|
Laser |
fireWeapon(Defender defender)
Return the bullet this UFO is about to fire. |
int |
getUFOType()
Get an int represented the type for this UFO |
int |
getXPosition()
Get the current x coordinate of the center of this UFO. |
int |
getYPosition()
Get the current y coordinate of the center of this UFO. |
boolean |
isHitByLaser(Laser theLaser)
Returns whether this UFO intersects this Laser |
void |
recordHit()
Updates the Object to record that it has been hit by a Laser. |
boolean |
removeMeFromGame()
Returns true if this UFO has been destroyed. |
boolean |
shootsThisTurn(Defender defender)
Return true if this UFO fires this during this tick. |
void |
takeOneStep(Defender defender)
Updates the position of the UFO for the next time it is redrawn. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SIMPLE_SAUCER
public static final int FAST_SHIP
public static final int SUPER_SAUCER
Constructor Detail |
---|
public UFO(int startX, int startY, int uFOType)
startX
- The initial x coordinatestartY
- The initial y coordinateuFOType
- An int representing the type of UFO this is.Method Detail |
---|
public int getXPosition()
public int getYPosition()
public int getUFOType()
public void takeOneStep(Defender defender)
defender
- The Defender object. May safely be ignored, but some UFO types
may use this information.public boolean shootsThisTurn(Defender defender)
defender
- The Defender object. May safely be ignored, but some UFO types
may use this information.
public Laser fireWeapon(Defender defender)
defender
- The Defender object. May safely be ignored, but some UFO types
may use this information.
public boolean isHitByLaser(Laser theLaser)
theLaser
-
public void recordHit()
public boolean removeMeFromGame()