|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hermes.animation.AnimatedSprite
public class AnimatedSprite
This class is used to process, store, and play animations.
Field Summary |
---|
Fields inherited from interface hermes.animation.AnimationConstants |
---|
INFINITE_LOOPS |
Constructor Summary | |
---|---|
AnimatedSprite()
|
Method Summary | |
---|---|
int |
addAnimation(Animation animation)
|
PImage |
animate()
This method handles advancing the Animation's frame, and then returns the PImage corresponding to the Animation's current state |
Animation |
getAnimation(int index)
Retrieves an Animation stored with this AnimatedSprite |
int |
getInitialFrame()
|
int |
getLastFrame()
|
int |
getNumberOfAnimations()
the number of Animations added to this AnimatedSprite |
int |
getPlayDirection()
|
boolean |
isPlayDirectionLeftToRight()
|
void |
overrideInterruptible(boolean interruptible)
Overrides interruptible -- valid until next call to setActiveAnimation. |
void |
overrideMillisecondsPerFrame(int millisecondsPerFrame)
Overrides millisecondsPerFrame for this playback. |
void |
overrideNumberOfTimesToPlay(int numberOfTimesToPlay)
Overrides millisecondsPerFrame -- valid until next call to setActiveAnimation. |
void |
pause()
This pauses the Animated Sprite on its currentFrame. |
void |
reverse()
This switches the direction of the playback and swaps the initial and final frames. |
void |
setActiveAnimation(int animationIndex)
Sets the active animation that the Sprite will use when drawn |
void |
setInitialFrame(int initialFrame)
Sets the initial frame for this playback. |
void |
setLastFrame(int lastFrame)
Sets the last frame for this playback. |
void |
setPlayDirection(int direction)
Sets the direction of play. |
void |
unpause()
This tells the Animated Sprite to play its activeAnimation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnimatedSprite()
Method Detail |
---|
public int addAnimation(Animation animation)
public void setActiveAnimation(int animationIndex)
Note: This uses parameters internal to the specified animation for : millisecondsPerFrame, interruptible, isLooping, numberOfLoops. If you want to override any of these temporarily (ie: just for this playback, this does not change the Animation's internal parameters) use the override methods described in this class following your call to this method. Eg.
setActiveAnimation(3);
overrideInterruptible(true); //allows this playback to be interrupted
overrideNumberOfTimesToPlay(3);//will play through the Animation 3 times
animationIndex
- numerical index used to select a specific animation of a spritepublic void overrideInterruptible(boolean interruptible)
interruptible
- boolean determining if this AnimatedSprite should be interruptiblepublic void overrideNumberOfTimesToPlay(int numberOfTimesToPlay)
numberOfTimesToPlay
- Number of times this animation should playpublic Animation getAnimation(int index)
index
- The index of the animation being retrieved
public int getNumberOfAnimations()
public void overrideMillisecondsPerFrame(int millisecondsPerFrame)
millisecondsPerFrame
- How many milliseconds each Animation frame will play forpublic int getInitialFrame()
public void setInitialFrame(int initialFrame)
playDirectionLeftToRight()
or playDirectionRightToLeft()
until the last frame is reached. If the Animation must loop again, it will start the process over
again at the initial frame.
initialFrame
- the index of the initial frame in the Animationpublic int getLastFrame()
public void setLastFrame(int lastFrame)
playDirectionLeftToRight()
or playDirectionRightToLeft()
until the last frame is reached. If the Animation must loop again, it will start the process over
again at the initial frame.
lastFrame
- the index of the last frame in the Animationpublic void setPlayDirection(int direction)
direction
- Number used to determine direction of playback. "1" for left-to-right, and "-1" for right-to-leftpublic boolean isPlayDirectionLeftToRight()
public int getPlayDirection()
public void unpause()
pause()
to restart the play.
public void pause()
public PImage animate()
public void reverse()
reverse()
, they will play C-B-A.
If the Animation is interruptible, the reverse will happen immediately. If the
Animation is not interruptible, the changes will be come into effect when the Animation
has been played through. These changes are only relevant while this is the active Animation
and they are valid for this playback.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |