|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSprite
com.brackeen.javagamebook.tilegame.sprites.Creature
public abstract class Creature
A Creature is a Sprite that is affected by gravity and can die. It has four Animations: moving left, moving right, dying on the left, and dying on the right.
Field Summary | |
---|---|
static int |
STATE_DEAD
|
static int |
STATE_DYING
|
static int |
STATE_NORMAL
|
Constructor Summary | |
---|---|
Creature(Animation left,
Animation right,
Animation deadLeft,
Animation deadRight)
Creates a new Creature with the specified Animations. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
void |
collideHorizontal()
Called before update() if the creature collided with a tile horizontally. |
void |
collideVertical()
Called before update() if the creature collided with a tile vertically. |
float |
getMaxSpeed()
Gets the maximum speed of this Creature. |
int |
getState()
Gets the state of this Creature. |
boolean |
isAlive()
Checks if this creature is alive. |
boolean |
isFlying()
Checks if this creature is flying. |
void |
setState(int state)
Sets the state of this Creature to STATE_NORMAL, STATE_DYING, or STATE_DEAD. |
void |
update(long elapsedTime)
Updates the animaton for this creature. |
void |
wakeUp()
Wakes up the creature when the Creature first appears on screen. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int STATE_NORMAL
public static final int STATE_DYING
public static final int STATE_DEAD
Constructor Detail |
---|
public Creature(Animation left, Animation right, Animation deadLeft, Animation deadRight)
Method Detail |
---|
public java.lang.Object clone()
public float getMaxSpeed()
public void wakeUp()
public int getState()
public void setState(int state)
public boolean isAlive()
public boolean isFlying()
public void collideHorizontal()
public void collideVertical()
public void update(long elapsedTime)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |