Class UFO

java.lang.Object
  extended by UFO

public class UFO
extends java.lang.Object

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

SIMPLE_SAUCER

public static final int SIMPLE_SAUCER

FAST_SHIP

public static final int FAST_SHIP

SUPER_SAUCER

public static final int SUPER_SAUCER
Constructor Detail

UFO

public UFO(int startX,
           int startY,
           int uFOType)
Constructs an UFO object given its type and initial position

Parameters:
startX - The initial x coordinate
startY - The initial y coordinate
uFOType - An int representing the type of UFO this is.
Method Detail

getXPosition

public int getXPosition()
Get the current x coordinate of the center of this UFO.

Returns:
The current x coordinate of the center of this UFO.

getYPosition

public int getYPosition()
Get the current y coordinate of the center of this UFO.

Returns:
The current y coordinate of the center of this UFO.

getUFOType

public int getUFOType()
Get an int represented the type for this UFO

Returns:
The int representing the type of this UFO

takeOneStep

public void takeOneStep(Defender defender)
Updates the position of the UFO for the next time it is redrawn.

Parameters:
defender - The Defender object. May safely be ignored, but some UFO types may use this information.

shootsThisTurn

public boolean shootsThisTurn(Defender defender)
Return true if this UFO fires this during this tick.

Parameters:
defender - The Defender object. May safely be ignored, but some UFO types may use this information.
Returns:
Whether or not this UFO shoots on this tick

fireWeapon

public Laser fireWeapon(Defender defender)
Return the bullet this UFO is about to fire.

Parameters:
defender - The Defender object. May safely be ignored, but some UFO types may use this information.
Returns:
The bullet this UFO is about to fire.

isHitByLaser

public boolean isHitByLaser(Laser theLaser)
Returns whether this UFO intersects this Laser

Parameters:
theLaser -
Returns:
true if this UFO intersects this Laser

recordHit

public void recordHit()
Updates the Object to record that it has been hit by a Laser. This method is called every time the UFO is struck by a Laser.


removeMeFromGame

public boolean removeMeFromGame()
Returns true if this UFO has been destroyed.

Returns:
true if the UFO has been destroyed.