|
Genuts API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genuts.gameui.Sprite
com.genuts.gameui.ImageSequenceSprite
com.genuts.gameui.LCDSprite
com.genuts.gameui.LCDAnimatedSprite
This sprite is an animation of pictures of a LCDSprite. Its goal is to provide an object to animate picture along the time with a sequence of pictures.
The animation should be done sequentially. This means that animation
for all LCDAnimatedSprites is made in the tick, the order depends
on their id. To activate this set the value of @{#setSequentialAnimation(booloean) setSequentialAnimation(booloean)}
to true
. That method is global to all LCDAnimatedSprites,
if one of them is set to a sequential animation, all other too. And
oppositely, if one is set to not have anymore a sequential animation,
all other too.
To respect this, the frequence of the animation must be greater
or equal to the number of LCDAnimatedSprites in the playfield.
LCDSprite
Constructor Summary | |
LCDAnimatedSprite(int id,
java.awt.Image anim,
int nbh,
int nbv,
int[][] pos,
int frequence)
Initializes the sprite, with an animation image. |
Method Summary | |
void |
animate(int ticks)
Animates the sprite as desired. |
int |
getCurrentRemindTick()
Gets the value of currentTick. |
int |
getFrequence()
Returns the number of ticks before a picture of the animation change. |
int |
getLCDAnimatedSpriteCount()
Number of LCDAnimatedSprite in the parent playfield. |
boolean |
isSequentialAnimation()
Indicates if the animation of all LCDAnimatedSprite is made sequentially. |
void |
setCurrentRemindTick(int v)
Sets the value of currentTick. |
void |
setFrequence(int freq)
Sets the number of ticks before a picture of the animation change. |
protected void |
setLCDAnimatedSpriteCount(int nb)
Set the number of LCDAnimatedSprite in the parent playfield. |
protected void |
setParent(PlayField parent)
Sets the parent playfield of this sprite. |
void |
setSequentialAnimation(boolean sequential)
Sets if the animation of all LCDAnimatedSprite is made sequentially. |
void |
tick(int ticks)
Receives a tick from the playfield to animate picture |
Methods inherited from class com.genuts.gameui.LCDSprite |
checkCollision, getContinuity, getCurrentPosition, getPositions, initContinuity, initPosition, nextPicture, previousPicture, removeContinuity, setContinuity, setCurrentPictureNumber, setCurrentPosition, setHorizontalPicture, setPositions, setSequence, setVerticalPicture, toString |
Methods inherited from class com.genuts.gameui.ImageSequenceSprite |
getCurrentPictureNumber, getHorizontalPicture, getHorizontalPicturesCount, getPicturesCount, getSequence, getVerticalPicture, getVerticalPicturesCount, isSequenceEnded, isSequenceLoop, paint, sequenceEnded, setSequenceEnded, setSequenceLoop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LCDAnimatedSprite(int id, java.awt.Image anim, int nbh, int nbv, int[][] pos, int frequence)
id
- ID of this sprite.anim
- An image containing all pictures of the animation.nbh
- Horizontally number of pictures in the image.nbv
- Vertically number of pictures in the image.pos
- X and Y posotion for each sequence.frequence
- Number of ticks to wait before to change a picture.Method Detail |
public int getFrequence()
public void setFrequence(int freq)
freq
- The number of ticks before a picture change, or -1 if
the picture does not change.public int getCurrentRemindTick()
public void setCurrentRemindTick(int v)
v
- Value to assign to currentTick.public int getLCDAnimatedSpriteCount()
protected void setLCDAnimatedSpriteCount(int nb)
nb
- The new number of LCDAnimatedSprite in the
parent playfield.public boolean isSequentialAnimation()
true
if the animation is made sequentially,
false
otherwise.public void setSequentialAnimation(boolean sequential)
sequential
- true
if the animation is made sequentially,
false
otherwise.protected void setParent(PlayField parent)
Sprite
setParent
in class LCDSprite
public void tick(int ticks)
tick
in interface Tickable
ticks
- the animation of all LCDAnimatedSprite is
made sequentially.if the animation of all LCDAnimatedSprite is
made sequentially.ticks Number of ticks from the playfield.public void animate(int ticks)
ticks
- Number of ticks from the playfield
|
Genuts API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |