|
GTGE API | ||||||||
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.sprite.PatternSprite
public class PatternSprite
Sprite that its images is taken from another sprite (the pattern).
PatternSprite
is used to make a number of sprite that share same
images and to have same animation sequence.
A sprite that not created in a same time will have a different animation
sequence (the new sprite will start with the first frame animation,
and the old one perhaps at the last animation). This kind of sprite will
assure that pattern sprites that have same pattern will animated in the same
sequence.
Note: Don't forget to update the pattern sprite in order to keep the pattern animate.
Field Summary |
---|
Fields inherited from class com.golden.gamedev.object.Sprite |
---|
height, width |
Constructor Summary | |
---|---|
PatternSprite(Sprite pattern)
Creates new PatternSprite with specified pattern. |
|
PatternSprite(Sprite pattern,
double x,
double y)
Creates new PatternSprite with specified pattern and
coordinate. |
Method Summary | |
---|---|
Sprite |
getPattern()
Returns the pattern sprite associates with this sprite. |
void |
render(Graphics2D g,
int x,
int y)
Renders sprite image to specified graphics context and specified location. |
void |
setPattern(Sprite pattern)
Sets the pattern of this sprite. |
Methods inherited from class com.golden.gamedev.object.Sprite |
---|
addHorizontalSpeed, addVerticalSpeed, forceX, forceY, getBackground, getDataID, getDistance, getHeight, getHorizontalSpeed, getID, getImage, getLayer, getOldX, getOldY, getScreenX, getScreenY, getVerticalSpeed, getWidth, getX, getY, isActive, isImmutable, isOnScreen, isOnScreen, move, moveTo, moveX, moveY, render, setActive, setBackground, setDataID, setHorizontalSpeed, setID, setImage, setImmutable, setLayer, setLocation, setMovement, setSpeed, setVerticalSpeed, setX, setY, update, updateMovement |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PatternSprite(Sprite pattern, double x, double y)
PatternSprite
with specified pattern and
coordinate.
public PatternSprite(Sprite pattern)
PatternSprite
with specified pattern.
Method Detail |
---|
public void render(Graphics2D g, int x, int y)
Sprite
render
in class Sprite
g
- graphics contextx
- screen x-coordinatey
- screen y-coordinatepublic Sprite getPattern()
public void setPattern(Sprite pattern)
|
GTGE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |