|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavoids.BasicSprite
javoids.Sprite
javoids.ShieldedSprite
javoids.Ship
public final class Ship
A space ship sprite class.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javoids.BasicSprite |
|---|
BasicSprite.Collision, BasicSprite.Gravity |
| Field Summary | |
|---|---|
protected static int |
AFTERBURNER_MULTIPLIER
The amount to increase the maximum speed by when using afterburners |
private static int |
count
the number of these sprites already created |
private Item.Type |
currentItem
the current item (GUN1 is always available) |
protected static int |
DEFAULT_LIVES
the defualt number of lives |
protected static int |
DEFAULT_SIZE
the sprite's default size |
protected static int |
DEFAULT_VELOCITY
the default velocity |
protected static int |
FREE_SHIP_POINTS
the number of points that need to be obtained before a free life is rewarded |
private int |
freeLives
the number of free lives rewarded |
private int |
gravityDuration
the duration for the current gravity effect |
private java.util.HashMap<Item.Type,Item> |
items
a mapping of item names to items that this sprite possesses |
protected static int |
MAX_NUMBER
The maximum number of these sprites allowed in the game |
protected static int |
MAX_SIZE
the sprite's maximum size |
protected static int |
MAXIMUM_DAMAGE_CAPACITY
the maximum damage level |
protected static int |
MIN_SIZE
the sprite's minimum size |
private static long |
serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object |
private boolean |
soundAfterburner
is the afterburner sound to be played? |
| Fields inherited from class javoids.BasicSprite |
|---|
size |
| Constructor Summary | |
|---|---|
Ship(BasicSprite parent,
Health health,
Move move,
int _size)
Constructor |
|
| Method Summary | ||
|---|---|---|
void |
addItems(java.util.HashMap<Item.Type,Item> _items)
|
|
void |
apply(BasicSprite sprite)
Apply the effects of the power up to the ship |
|
private void |
checkFreeLife()
Check to see if a free life should be awarded (takes away a death). |
|
void |
cycleWeapon(Item.Direction direction)
Go throught the weapons until one with ammunition is found |
|
Item.Type |
getCurrentItem()
|
|
int |
getDefaultSize()
|
|
ImageMap.Name |
getImageNumber()
|
|
java.util.HashMap<Item.Type,Item> |
getItems()
|
|
int |
getMaximumSize()
|
|
int |
getMinimumSize()
|
|
int |
modifyDamage(int _damage)
modify the sprite's damage level |
|
int |
modifyPoints(int points)
modify the sprite's point total |
|
void |
move()
Move the sprite and check for an end to gravity effects. |
|
void |
performAction(KeyMap.Action action,
SpriteVector<Ship> ships,
SpriteVector<Bullet> bullets,
SpriteVector<Mine> mines,
SpriteVector<Javoid> javoids,
SpriteVector<Explosion> explosions)
Perform a sepcified action |
|
void |
resetItems()
reset all items to their default values |
|
void |
restore(double x,
double y,
double maxVelocity,
double direction)
|
|
static void |
restoreCount()
restore an item's number of uses to 0 |
|
void |
setCurrentItem(Item.Type item)
|
|
void |
setGravityDuration(int _gravityDuration)
|
|
void |
setPoints(int points)
set the sprite's point value |
|
void |
setSize(int _size)
set the sprite's size |
|
void |
setSoundAfterburner(boolean _soundAfterburner)
|
|
void |
setWeaponBest()
set the current item to the best weapon the ship owns |
|
SpriteVector<Bullet> |
spawnBullets()
|
|
void |
thrust(double amount)
Push the ship forward by the amount specified |
|
java.lang.String |
toString()
Provide a String representation of this object. |
|
void |
useAfterBurner()
Use the ship's afterburners if possible |
|
SpriteVector<Bullet> |
useAutomaticGun()
|
|
void |
useBomb(SpriteVector<Javoid> sprites,
SpriteVector<Explosion> explosions)
|
|
SpriteVector<Bullet> |
useGun()
|
|
void |
useJumps()
use a hyperspace jump to change position and direction instantly and randomly. |
|
|
useMegaBomb(SpriteVector<E> sprites,
SpriteVector<Explosion> explosions)
|
|
void |
useShields()
activate the ship's shields |
|
| Methods inherited from class javoids.ShieldedSprite |
|---|
accelerate, collide, collisionDetected, draw, getMass, getShield, setDirection, setMove, setRotation, setShield, turn |
| Methods inherited from class javoids.Sprite |
|---|
getAreas, getColors, getMultiplier, getOriginalImage, getShape, setAreas, setColors, setColors, setImage, setShape |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
protected static final int AFTERBURNER_MULTIPLIER
protected static final int MAX_NUMBER
protected static final int MAXIMUM_DAMAGE_CAPACITY
protected static final int MAX_SIZE
protected static final int MIN_SIZE
protected static final int DEFAULT_SIZE
protected static final int DEFAULT_VELOCITY
protected static final int DEFAULT_LIVES
protected static final int FREE_SHIP_POINTS
private static int count
private int freeLives
private java.util.HashMap<Item.Type,Item> items
private Item.Type currentItem
private int gravityDuration
private boolean soundAfterburner
| Constructor Detail |
|---|
public Ship(BasicSprite parent,
Health health,
Move move,
int _size)
parent - the parent of this spritehealth - the health informationmove - the movment information_size - the size this should be| Method Detail |
|---|
public int getMaximumSize()
public int getMinimumSize()
public int getDefaultSize()
public void setSize(int _size)
BasicSprite
setSize in class Sprite_size - the size to set the sprite's size topublic java.util.HashMap<Item.Type,Item> getItems()
public Item.Type getCurrentItem()
public void setSoundAfterburner(boolean _soundAfterburner)
_soundAfterburner - the sound for the ship's afterburner enginepublic void setCurrentItem(Item.Type item)
item - the the currently selected itempublic void setWeaponBest()
public void setGravityDuration(int _gravityDuration)
_gravityDuration - the length of time the gravity effect on the ship will lastpublic void setPoints(int points)
BasicSprite
setPoints in class BasicSpritepoints - the number of points to set this sprite's point total topublic int modifyPoints(int points)
BasicSprite
modifyPoints in class BasicSpritepoints - the number of points to award
private void checkFreeLife()
public void cycleWeapon(Item.Direction direction)
direction - the direction to cycle through the list of weapons
public void restore(double x,
double y,
double maxVelocity,
double direction)
x - the x coordinatey - the y coordinatemaxVelocity - the maximum velocitydirection - the direction the ship is facingpublic static void restoreCount()
public void thrust(double amount)
amount - the amount of thrust to usepublic void move()
move in class ShieldedSpritepublic int modifyDamage(int _damage)
BasicSprite
modifyDamage in class BasicSprite_damage - the damage the sprite sustained
public void performAction(KeyMap.Action action,
SpriteVector<Ship> ships,
SpriteVector<Bullet> bullets,
SpriteVector<Mine> mines,
SpriteVector<Javoid> javoids,
SpriteVector<Explosion> explosions)
action - the action to perform in the gameships - the list of all ships in the gamebullets - the list of all bullets in the gamemines - the list of all mines in the gamejavoids - the list of all javoids in the gameexplosions - the list of all explosions in the game
public void useBomb(SpriteVector<Javoid> sprites,
SpriteVector<Explosion> explosions)
sprites - the list of sprites to apply the effects of the bomb on.explosions - the list of all explosions in the game
public <E extends BasicSprite> void useMegaBomb(SpriteVector<E> sprites,
SpriteVector<Explosion> explosions)
E - the type of sprite being explodedsprites - the list of sprites to apply the effects of the bomb on.explosions - the list of all explosions in the gamepublic void useJumps()
public void useShields()
public void useAfterBurner()
public SpriteVector<Bullet> useGun()
public SpriteVector<Bullet> useAutomaticGun()
public SpriteVector<Bullet> spawnBullets()
public void apply(BasicSprite sprite)
sprite - the power up to usepublic void addItems(java.util.HashMap<Item.Type,Item> _items)
_items - the list of items to add the the ship's listpublic ImageMap.Name getImageNumber()
getImageNumber in class Spritepublic void resetItems()
public java.lang.String toString()
toString in class ShieldedSprite
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||