|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectse.liu.student.kimgr905.tilegame.sprites.Sprite
se.liu.student.kimgr905.tilegame.sprites.Ship
public abstract class Ship
A Ship is a Sprite that has three Animations and a certain amount of hitpoints.
| Field Summary | |
|---|---|
private boolean |
awake
|
private static int |
EXPLODE_TIME
|
private Animation |
exploding
|
private int |
hitPoints
|
private Animation |
normal
|
private long |
stateTime
|
| Fields inherited from class se.liu.student.kimgr905.tilegame.sprites.Sprite |
|---|
anim, STATE_DEAD, STATE_EXPLODING, STATE_NORMAL, STATE_SHOOTING |
| Constructor Summary | |
|---|---|
Ship(Animation normal,
Animation exploding)
Creates a ship with the specified animation. |
|
| Method Summary | |
|---|---|
void |
changePath()
Changes the ships path, should be overwritten by ships that need to change path by certain patterns. |
void |
changePath(Player player)
Same as changePath(), but also takes a Player argument for ships that follow the player. |
java.lang.Object |
clone()
Clone is used to create a deepcopy of the ship. |
int |
getHitPoints()
Return current hit points of the ship. |
void |
hit()
When the ship gets hit it loses a hitpoint. |
(package private) boolean |
isAwake()
|
(package private) void |
setHitPoints(int hitPoints)
|
void |
setState(int state)
Sets the state of the ship. |
void |
shoot()
Sets shooting variables, should be overwritten by ships that shoot. |
void |
update(long elapsedTime)
Updates the animaton for this ship. |
void |
wakeUp()
Awakens the ship. |
| Methods inherited from class se.liu.student.kimgr905.tilegame.sprites.Sprite |
|---|
getHeight, getImage, getState, getVelocityX, getVelocityY, getWidth, getX, getY, isAlive, setVelocityX, setVelocityY, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int EXPLODE_TIME
private boolean awake
private int hitPoints
private long stateTime
private final Animation normal
private final Animation exploding
| Constructor Detail |
|---|
public Ship(Animation normal,
Animation exploding)
normal - normal animationexploding - exploding animation| Method Detail |
|---|
public final java.lang.Object clone()
clone in class Spritepublic final void update(long elapsedTime)
update in class SpriteelapsedTime - the time elapsed since the last update in mspublic final void setState(int state)
setState in class Spritestate - the state of the shippublic void wakeUp()
final boolean isAwake()
public final int getHitPoints()
final void setHitPoints(int hitPoints)
public void hit()
public void shoot()
public void changePath()
public void changePath(Player player)
player - the player
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||