|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.golden.gamedev.object.Sprite
com.golden.gamedev.object.AnimatedSprite
gameobjects.AbstractGameObject
gameobjects.characters.AbstractCharacterSprite
public abstract class AbstractCharacterSprite
This class is holding basic animations that every game character needs.
| Field Summary | |
|---|---|
static int |
DIR_LEFT
|
static int |
DIR_NO_DIR
|
static int |
DIR_RIGHT
|
| Constructor Summary | |
|---|---|
AbstractCharacterSprite(java.lang.String name,
java.lang.String bshName,
double x,
double y,
java.awt.Color speechColor,
com.golden.gamedev.engine.BaseLoader bsLoader,
com.golden.gamedev.engine.BaseInput bsInput,
com.golden.gamedev.engine.BaseAudio bsSound)
Creates a new character sprite for a game character |
|
| Method Summary | |
|---|---|
void |
addAction(AbstractGameAction action)
Convenience method to add a game action to the characters game action scheduler without calling the getGameActionScheduler() method first. |
void |
addActions(java.util.List<AbstractGameAction> actions)
Convenience method to add a list of game actions to the characters game action scheduler at once without calling the getGameActionScheduler() method first. |
int |
getDirection()
Returns the current set direction value as a constant like AbstractCharacterSprite.DIR_RIGHT |
GameActionScheduler |
getGameActionScheduler()
Returns the game action scheduler |
int |
getPreviousDirection()
Return the direction that was set before a new direction was set with setDirection() |
java.awt.Color |
getSpeechColor()
Returns the speech color of this character |
double |
getTargetX()
Returns the x-coordinate of the sprite's target position |
double |
getTargetY()
Returns the y-coordinate of the sprite's target position |
boolean |
hasJustUsedExit()
Determines whether the character has just used an exit |
void |
pause()
Convenience method that pauses the game action manager of the character |
void |
render(java.awt.Graphics2D g)
|
void |
resume()
Convenience method that resumes the game action manager of the character |
void |
setDirection(int dir)
Sets the current direction to the specified constant. |
void |
setJustUsedExit(boolean usedExit)
Sets if the character just used an exit. |
void |
setTargetPosition(double x,
double y)
Sets the new target position for the character |
void |
setTargetX(double x)
Sets the new target x-coordinate for the character |
void |
setTargetY(double y)
Sets the new target y-coordinate for the character |
void |
update(long elapsedTime)
|
| Methods inherited from class gameobjects.AbstractGameObject |
|---|
compareTo, getAnimPool, getAnimScheduler, getBshName, getBsLoader, getDescription, getGameLocation, getHotspot, getMidX, getMidY, getName, isPicked, setDescription, setGameLocation, setName, setToPicked |
| Methods inherited from class com.golden.gamedev.object.AnimatedSprite |
|---|
getAnimationTimer, getFinishAnimationFrame, getFrame, getImage, getImage, getImages, getStartAnimationFrame, isAnimate, isLoopAnim, render, setAnimate, setAnimationFrame, setAnimationTimer, setFrame, setImage, setImages, setLoopAnim |
| Methods inherited from class com.golden.gamedev.object.Sprite |
|---|
addHorizontalSpeed, addVerticalSpeed, forceX, forceY, getBackground, getDataID, getDistance, getHeight, getHorizontalSpeed, getID, getLayer, getOldX, getOldY, getScreenX, getScreenY, getVerticalSpeed, getWidth, getX, getY, isActive, isImmutable, isOnScreen, isOnScreen, move, moveTo, moveX, moveY, setActive, setBackground, setDataID, setHorizontalSpeed, setID, setImmutable, setLayer, setLocation, setMovement, setSpeed, setVerticalSpeed, setX, setY |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DIR_NO_DIR
public static final int DIR_LEFT
public static final int DIR_RIGHT
| Constructor Detail |
|---|
public AbstractCharacterSprite(java.lang.String name,
java.lang.String bshName,
double x,
double y,
java.awt.Color speechColor,
com.golden.gamedev.engine.BaseLoader bsLoader,
com.golden.gamedev.engine.BaseInput bsInput,
com.golden.gamedev.engine.BaseAudio bsSound)
name - Name of the characterbshName - name that will be used for this character in
beanshell scripts
set to the character at first. Use it like [YourCharacterClass].WALK_LEFTx - x-coordinate, where the sprite should initially appeary - y-coordinate, where the sprite should initially appearspeechColor - color for the spoken dialog lines on screenbsLoader - bsInput - bsSound - | Method Detail |
|---|
public void setDirection(int dir)
AbstractCharacterSprite.DIR_LEFT
dir - constant defning the direction of the characterpublic int getDirection()
AbstractCharacterSprite.DIR_RIGHT
public int getPreviousDirection()
public void setTargetPosition(double x,
double y)
x - x-coordinatey - y-coordinatepublic void setTargetX(double x)
x - x-coordinatepublic void setTargetY(double y)
y - y-coordinatepublic double getTargetX()
public double getTargetY()
public java.awt.Color getSpeechColor()
public GameActionScheduler getGameActionScheduler()
public void setJustUsedExit(boolean usedExit)
usedExit - player just used an exit? --> true=yes, false=nopublic boolean hasJustUsedExit()
public void addAction(AbstractGameAction action)
action - game action to add to the game action managerpublic void addActions(java.util.List<AbstractGameAction> actions)
actions - game actions to add to the game action managerpublic void pause()
public void resume()
public void render(java.awt.Graphics2D g)
render in class AbstractGameObjectpublic void update(long elapsedTime)
update in class AbstractGameObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||