|
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.AnimatedSprite
This sprite is an animation of pictures in one image. Its goal is to provide an object with animated picture along the time with a sequence of pictures.
The image is composed of ordered picture for the left to the rigtht, and from the top to bottom. All pictures have the same size.
For example, if want to have this animation:
we have to use this image:
![]() |
Number of pictures horizontally: 4 Number of pictures vertically: 3 |
Sprite sprite = new AnimatedSprite(image, 4, 3, 5);
ImageSequenceSprite
Constructor Summary | |
AnimatedSprite(java.awt.Image anim,
int nbh,
int nbv,
int frequence)
Initializes the sprite, with an animation image. |
Method Summary | |
void |
animate(int ticks)
Animates the sprite as desired. |
int |
getCurrentRemindTick()
Gets the number of ticks to way before the next picture will be displayed. |
int |
getFrequence()
Returns the number of ticks to wait between two pictures of the animation. |
boolean |
isPaused()
Gets pause state for this animated sprite. |
void |
setCurrentRemindTick(int v)
Sets the number of ticks to way before the next picture will be displayed. |
void |
setFrequence(int freq)
Sets the number of ticks to wait between two pictures of the animation. |
void |
setPause(boolean pause)
Sets pause state for this animated sprite. |
void |
tick(int ticks)
Receives a tick from the playfield to animate picture. |
Methods inherited from class com.genuts.gameui.ImageSequenceSprite |
getCurrentPictureNumber, getHorizontalPicture, getHorizontalPicturesCount, getPicturesCount, getSequence, getVerticalPicture, getVerticalPicturesCount, isSequenceEnded, isSequenceLoop, nextPicture, paint, previousPicture, sequenceEnded, setCurrentPictureNumber, setHorizontalPicture, setSequence, setSequenceEnded, setSequenceLoop, setVerticalPicture |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AnimatedSprite(java.awt.Image anim, int nbh, int nbv, int frequence)
anim
- An image containing all pictures of the animation.nbh
- Horizontaly number of pictures in the image.nbv
- Verticaly number of pictures in the image.frequence
- Number of ticks to wait between two pictures
of the animation, or -1 if the picture doesn't change.Method Detail |
public int getFrequence()
public void setFrequence(int freq)
freq
- The number of ticks to wait between two pictures of the animation,
or -1 if the picture doesn't change.public int getCurrentRemindTick()
public void setCurrentRemindTick(int v)
v
- Number of ticks to way before the next picture will be displayed.public void setPause(boolean pause)
pause
- true
to set the animated sprite in
pause state, false
otherwise.public boolean isPaused()
true
to set the animated sprite in
pause state, false
otherwise.public void tick(int ticks)
If getCurrentRemindTick() is equal to 0, next picture is
displayed.
There is no animation if getFrequence() is equal to -1.
tick
in interface Tickable
ticks
- Number of ticks from the playfieldpublic 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 |