Genuts API

com.genuts.gameui
Class SimpleAnimationSprite

java.lang.Object
  |
  +--com.genuts.gameui.Sprite
        |
        +--com.genuts.gameui.ImageSequenceSprite
              |
              +--com.genuts.gameui.AnimatedSprite
                    |
                    +--com.genuts.gameui.SimpleAnimationSprite
All Implemented Interfaces:
java.lang.Cloneable, Tickable

public class SimpleAnimationSprite
extends AnimatedSprite

A simple animation sprite provides a sprite for an animated picture with several cycles of animation. When the number of cycle is done, the animation stops.

See Also:
AnimatedSprite

Constructor Summary
SimpleAnimationSprite(java.awt.Image seq, int nbh, int nbv, int frequence)
          Initializes the sprite, with an animation image with one cycle of animation.
SimpleAnimationSprite(java.awt.Image seq, int nbh, int nbv, int frequence, int cycles)
          Initializes the sprite, with an animation image with several animations cycles.
 
Method Summary
 int getCycles()
          Gets the number of cycles of this animation.
 int getDoneCycles()
          Gets the number of done cycles of this animation.
 boolean isSequenceEnded()
          Indicates if the animation for this object has ended.
 void resetAnimation()
          Reset the animation.
protected  void sequenceEnded()
          Indicate that all cycles of the animation are ended.
 void setCycles(int cycles)
          Sets the number of cycles for this animation.
 void setDoneCycles(int cycles)
          Sets the number of done cycles for this animation.
protected  void setParent(PlayField parent)
          Sets the parent playfield of this sprite.
 
Methods inherited from class com.genuts.gameui.AnimatedSprite
animate, getCurrentRemindTick, getFrequence, isPaused, setCurrentRemindTick, setFrequence, setPause, tick
 
Methods inherited from class com.genuts.gameui.ImageSequenceSprite
getCurrentPictureNumber, getHorizontalPicture, getHorizontalPicturesCount, getPicturesCount, getSequence, getVerticalPicture, getVerticalPicturesCount, isSequenceLoop, nextPicture, paint, previousPicture, setCurrentPictureNumber, setHorizontalPicture, setSequence, setSequenceEnded, setSequenceLoop, setVerticalPicture
 
Methods inherited from class com.genuts.gameui.Sprite
checkCollision, cloneSprite, collisionWith, getActionSprite, getBackground, getBottomCollisionOffset, getBounds, getFinalActionSprite, getFinalWrapper, getHeight, getId, getImage, getLeftCollisionOffset, getParent, getPosition, getRightCollisionOffset, getSize, getTopCollisionOffset, getWidth, getWrapper, getX, getY, invalidate, isBackgroundSprite, isPremode, isSpriteAt, isValidate, isVisible, preCollisionWith, repaint, setBackground, setBackgroundSprite, setBottomCollisionOffset, setBounds, setBounds, setId, setImage, setLeftCollisionOffset, setPosition, setPremode, setRightCollisionOffset, setSize, setTopCollisionOffset, setVisible, setWrapper, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleAnimationSprite

public SimpleAnimationSprite(java.awt.Image seq,
                             int nbh,
                             int nbv,
                             int frequence)
Initializes the sprite, with an animation image with one cycle of animation.
The image is composed with all pictures of the animation.

Parameters:
seq - An image containing all pictures of the animation.
nbh - Horizontally number of pictures in the image.
nbv - Vertically number of pictures in the image.
frequence - Number of ticks to wait between two pictures of the animation.

SimpleAnimationSprite

public SimpleAnimationSprite(java.awt.Image seq,
                             int nbh,
                             int nbv,
                             int frequence,
                             int cycles)
Initializes the sprite, with an animation image with several animations cycles.
The image is composed with all pictures of the animation.

Parameters:
seq - An image containing all pictures of the animation.
nbh - Horizontally number of pictures in the image.
nbv - Vertically number of pictures in the image.
frequence - Number of ticks to wait between two pictures of the animation.
cycles - Number of cycles for the animation.
Method Detail

setCycles

public void setCycles(int cycles)
Sets the number of cycles for this animation.


getCycles

public int getCycles()
Gets the number of cycles of this animation.

Returns:
The number of cycles of the animation.

setDoneCycles

public void setDoneCycles(int cycles)
Sets the number of done cycles for this animation.


getDoneCycles

public int getDoneCycles()
Gets the number of done cycles of this animation.

Returns:
The number of done cycles of the animation.

isSequenceEnded

public boolean isSequenceEnded()
Indicates if the animation for this object has ended.

Overrides:
isSequenceEnded in class ImageSequenceSprite
Returns:
true if the animation has ended, false otherwise.

setParent

protected void setParent(PlayField parent)
Sets the parent playfield of this sprite.
Initializes the animation on the first picture and the right number of cycles.

Overrides:
setParent in class Sprite
Parameters:
parent - Parent playfield of this sprite

sequenceEnded

protected void sequenceEnded()
Indicate that all cycles of the animation are ended.
If all cycles are not done, initializes the animation.

Overrides:
sequenceEnded in class ImageSequenceSprite

resetAnimation

public void resetAnimation()
Reset the animation.


Genuts API

Genuts API