UFOSprite Class Reference
Represents a single UFO in the DemoGame. More...


Public Member Functions | |
UFOSprite (DemoGame game, int type) | |
Constructs a new UFOSprite. | |
void | draw (Graphics g) |
Draws this sprite to the given Graphics context. | |
boolean | equals (Object other) |
void | giveTarget (CowSprite cow) |
Gives a new target CowSprite for the UFO to approach. | |
int | kill () |
Disables this sprite's draw method. | |
void | setKillColor (Color color) |
void | update () |
Causes this sprite update its current state. | |
Public Attributes | |
final int | type |
Type of gesture shown on this UFO. | |
Static Public Attributes | |
static final int | UFO_SCORE = 100 |
Points killing a UFO is worth. | |
static final float | SPEEDX = 0.0035f |
UFO movement speed. | |
static final float | SPEEDY = 0.005f |
static final float | HOVER_HEIGHT = 0.1f |
Height at which the UFO will hover over a cow target. | |
static final int | ABDUCTION_TIME |
The amount of time it takes for a cow to be abducted given HOVER_HEIGHT and CowSprite#ABDUCT_SPEED. | |
static final int | EXPLODING_TIME = 30 |
Frames for UFO exploding. |
Detailed Description
Represents a single UFO in the DemoGame.
A UFOSprite is responsible for a UFO's behavior which includes swooping in from the top of the screen, moving towards a CowSprite. If it abducts a CowSprite, it heads back to the top of the screen and disappears.
UFOSprites are responsible for keeping track of a UFO's sounds, images, and states. UFOSprites come in five different types: circle, triangle, square, X, and Z. UFOSprites can be destroyed by a Player making a matching gesture and will reward that Player with 100 points.
Constructor & Destructor Documentation
Member Function Documentation
void draw | ( | Graphics | g | ) |
Draws this sprite to the given Graphics context.
- Parameters:
-
g the Graphics context this sprite should draw itself to.
Implements Sprite.

boolean equals | ( | Object | other | ) |
void giveTarget | ( | CowSprite | cow | ) |
int kill | ( | ) |
Disables this sprite's draw method.
Performs any necessary clean up and displays any effects that need to appear upon this object's death. Some sprites may be worth points when they are killed. If this is the case, kill will return those points as an integer.
- Returns:
- number of points this sprite is worth, if any.
Implements Sprite.

void setKillColor | ( | Color | color | ) |
void update | ( | ) |
Causes this sprite update its current state.
This may be moving by one step or adjusting it's current display picture.
Implements Sprite.

Member Data Documentation
final int ABDUCTION_TIME [static] |
(int) (HOVER_HEIGHT / CowSprite.ABDUCT_SPEED)
The amount of time it takes for a cow to be abducted given HOVER_HEIGHT and CowSprite#ABDUCT_SPEED.
final int EXPLODING_TIME = 30 [static] |
Frames for UFO exploding.
final float HOVER_HEIGHT = 0.1f [static] |
Height at which the UFO will hover over a cow target.
final float SPEEDX = 0.0035f [static] |
UFO movement speed.
final float SPEEDY = 0.005f [static] |
final int type |
Type of gesture shown on this UFO.
final int UFO_SCORE = 100 [static] |
Points killing a UFO is worth.
The documentation for this class was generated from the following file:
- /Users/dev/Documents/SVN brazos.cs.tcu.edu/trunk/FROG/src/frog/demo/UFOSprite.java