|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.golden.gamedev.object.Sprite
Sprite
is a graphical object that have its own behaviour.
Sprite behaviour is usually managed by Timer
class.
Field Summary | |
protected int |
height
|
int |
speedX
|
int |
speedY
|
protected int |
width
|
Constructor Summary | |
Sprite()
Creates new empty Sprite . |
|
Sprite(BufferedImage image,
int x,
int y)
Creates new Sprite with specified image and position. |
|
Sprite(int x,
int y)
Creates new Sprite with specified position. |
Method Summary | |
void |
forceX(int xs)
|
void |
forceY(int ys)
|
Background |
getBackground()
|
int |
getHeight()
|
int |
getID()
|
BufferedImage |
getImage()
|
int |
getLayer()
Layer can be used for z-order rendering. |
Timer |
getMovementTimer()
|
int |
getOldX()
|
int |
getOldY()
|
int |
getScreenX()
|
int |
getScreenY()
|
int |
getSpeedX()
|
int |
getSpeedY()
|
int |
getWidth()
|
int |
getX()
|
int |
getY()
|
boolean |
isActive()
|
boolean |
isOnScreen()
|
boolean |
isOnScreen(int leftOffset,
int topOffset,
int rightOffset,
int bottomOffset)
|
void |
move(int dx,
int dy)
|
void |
moveX(int dx)
|
void |
moveY(int dy)
|
void |
render(Graphics2D g)
|
void |
render(Graphics2D g,
int x,
int y)
|
void |
setActive(boolean b)
|
void |
setBackground(Background backgr)
|
void |
setID(int id)
|
void |
setImage(BufferedImage image)
|
void |
setLayer(int i)
|
void |
setLocation(int xs,
int ys)
|
void |
setMovementTimer(Timer t)
|
void |
setSpeed(int sx,
int sy)
|
void |
setSpeedX(int i)
|
void |
setSpeedY(int i)
|
void |
setX(int xs)
|
void |
setY(int ys)
|
void |
update()
|
protected void |
updateMovement()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int speedX
public int speedY
protected int width
protected int height
Constructor Detail |
public Sprite(BufferedImage image, int x, int y)
Sprite
with specified image and position.
public Sprite(int x, int y)
Sprite
with specified position.
public Sprite()
Sprite
.
Method Detail |
public void setBackground(Background backgr)
public Background getBackground()
public BufferedImage getImage()
public void setImage(BufferedImage image)
public int getWidth()
public int getHeight()
public void setLocation(int xs, int ys)
public void move(int dx, int dy)
public void setX(int xs)
public void setY(int ys)
public void forceX(int xs)
public void forceY(int ys)
public int getX()
public int getY()
public int getOldX()
public int getOldY()
public void moveX(int dx)
public void moveY(int dy)
public void setSpeed(int sx, int sy)
public void setSpeedX(int i)
public void setSpeedY(int i)
public int getSpeedX()
public int getSpeedY()
public int getScreenX()
public int getScreenY()
public boolean isOnScreen(int leftOffset, int topOffset, int rightOffset, int bottomOffset)
public boolean isOnScreen()
public void render(Graphics2D g)
public void render(Graphics2D g, int x, int y)
public void update()
protected void updateMovement()
public int getID()
public void setID(int id)
public int getLayer()
PlayField.setComparator(Comparator)
or
SpriteGroup.setComparator(Comparator)
for that purpose.
public void setLayer(int i)
public boolean isActive()
public void setActive(boolean b)
public void setMovementTimer(Timer t)
public Timer getMovementTimer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |