|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.huguesjohnson.tiamat.graphics.Sprite
class Sprite - animated sprite
| Field Summary | |
static boolean |
DEFAULT_MOVABLE
|
static int |
DIRECTION_DOWN
|
static int |
DIRECTION_LEFT
|
static int |
DIRECTION_RIGHT
|
static int |
DIRECTION_UP
|
static int |
MAX_DIRECTION
|
| Constructor Summary | |
Sprite(int direction,
int x,
int y,
java.lang.String absoluteDir,
java.lang.String[][] imagePaths,
java.awt.Component canvas)
|
|
| Method Summary | |
void |
draw()
draw the sprite at its current (x,y) location |
void |
draw(int x,
int y)
draw the sprite at the location specified by (x,y) |
void |
draw(int x1,
int y1,
int x2,
int y2)
draw the sprite to fill the area specified by rectangle (x1,y1)-(x2,y2), this is completely untested and not really useful |
java.awt.Component |
getCanvas()
|
java.awt.image.BufferedImage |
getCurrentImage()
|
int |
getDirection()
|
Sprite |
getFollower()
|
java.awt.image.BufferedImage |
getImage(int direction,
int step)
|
java.lang.String[][] |
getImagePaths()
|
java.lang.String[][] |
getImagePathsAbsolute()
|
boolean |
getIsMoving()
|
boolean |
getMovable()
|
int |
getStepIndex()
|
int |
getX()
|
int |
getY()
|
boolean |
importImageData(java.lang.String[][] imagePaths)
import image data, return success |
void |
move(int direction)
moves the sprite in the specified direction |
void |
onDeserialize(Formatter formatter,
java.lang.String absoluteDir)
The onDeserialize event should be fired after an object is de-serialized. |
void |
setAbsoluteDir(java.lang.String absoluteDir)
|
void |
setCanvas(java.awt.Component canvas)
|
void |
setDirection(int direction)
|
void |
setFollower(Sprite sprite)
|
void |
setImage(int direction,
int step,
java.lang.String imagePath)
|
void |
setIsMoving(boolean isMoving)
|
void |
setMovable(boolean movable)
|
void |
setStepIndex(int stepIndex)
|
void |
setX(int x)
|
void |
setY(int y)
|
java.lang.String |
toString()
return a string representation of the object |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DIRECTION_UP
public static final int DIRECTION_DOWN
public static final int DIRECTION_LEFT
public static final int DIRECTION_RIGHT
public static final int MAX_DIRECTION
public static final boolean DEFAULT_MOVABLE
| Constructor Detail |
public Sprite(int direction,
int x,
int y,
java.lang.String absoluteDir,
java.lang.String[][] imagePaths,
java.awt.Component canvas)
| Method Detail |
public int getDirection()
public void setDirection(int direction)
public int getStepIndex()
public void setStepIndex(int stepIndex)
public int getX()
public void setX(int x)
public int getY()
public void setY(int y)
public boolean getMovable()
public void setMovable(boolean movable)
public java.lang.String[][] getImagePaths()
public java.lang.String[][] getImagePathsAbsolute()
public java.awt.image.BufferedImage getCurrentImage()
public java.awt.image.BufferedImage getImage(int direction,
int step)
public void setImage(int direction,
int step,
java.lang.String imagePath)
public void setAbsoluteDir(java.lang.String absoluteDir)
public Sprite getFollower()
public void setFollower(Sprite sprite)
public java.awt.Component getCanvas()
public void setCanvas(java.awt.Component canvas)
public void setIsMoving(boolean isMoving)
public boolean getIsMoving()
public boolean importImageData(java.lang.String[][] imagePaths)
public void move(int direction)
public void draw()
draw in interface Drawable
public void draw(int x,
int y)
draw in interface Drawable
public void draw(int x1,
int y1,
int x2,
int y2)
draw in interface Drawablepublic java.lang.String toString()
public void onDeserialize(Formatter formatter,
java.lang.String absoluteDir)
onDeserialize in interface Storableformatter - the formatter to use to load any storable membersabsoluteDir - the working directory since all paths stored in the object should be relative
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||