com.golden.gamedev.object.sprite
Class PatternSprite
java.lang.Object
|
+--com.golden.gamedev.object.Sprite
|
+--com.golden.gamedev.object.sprite.PatternSprite
- public class PatternSprite
- extends Sprite
Sprite that its images is depend on other sprite (the pattern).
For example there are a number of sprite that share same images and
also wanted to have same animation sequence.
A sprite that not created in a same time will have different animation
sequence (the new sprite will start with the first frame animation,
and the old one perhaps at the last animation).
With PatternSprite the images is taken from one sprite (the pattern),
therefore all PatternSprite that have a same pattern will also
have a same animation sequence
(don't forget to update the pattern sprite in order to keep
the pattern animate).
PatternSprite class usually used on platform game,
where there are animated tiles that must have same animation sequence.
Methods inherited from class com.golden.gamedev.object.Sprite |
forceX, forceY, getBackground, getHeight, getID, getImage, getLayer, getMovementTimer, getOldX, getOldY, getScreenX, getScreenY, getSpeedX, getSpeedY, getWidth, getX, getY, isActive, isOnScreen, isOnScreen, move, moveX, moveY, render, setActive, setBackground, setID, setImage, setLayer, setLocation, setMovementTimer, setSpeed, setSpeedX, setSpeedY, setX, setY, update, updateMovement |
PatternSprite
public PatternSprite(Sprite pattern,
int x,
int y)
render
public void render(Graphics2D g,
int x,
int y)
- Overrides:
render
in class Sprite
getPattern
public Sprite getPattern()
setPattern
public void setPattern(Sprite pattern)
equals
public boolean equals(Object obj)
- Overrides:
equals
in class Object