gecco.client.animation
Class AnimatedPiece

java.lang.Object
  |
  +--gecco.client.Piece
        |
        +--gecco.client.animation.AnimatedPiece
Direct Known Subclasses:
Explosion

public class AnimatedPiece
extends Piece

This is a piece with animated symbol. The piece should be instanciated with a number of images (known as frames) that will be painted in order. The piece should be given a non-null Animator that handles the animation. The delay (in milliseconds) between the frames should also be set. An animated piece can either stop after the last frame has been drawn, or repeat forever (at least until the stopAnimation method is called). After the piece has been instanciated startAnimation should be called.

Author:
Andreas Enblom

Fields inherited from class gecco.client.Piece
MAX_MESSAGES
 
Constructor Summary
AnimatedPiece(int handle, Position position, String name, String type, Image[] frames, int delayBetweenFrames, boolean repeat, Animator animator)
           
 
Method Summary
 Image getSymbol()
          Gets the Symbol attribute of the AnimatedPiece object
 void startAnimation()
          Description of the Method
 void stopAnimation()
          Stops the animation and notifies the animator that the animation is done.
 
Methods inherited from class gecco.client.Piece
abortAllExecutingActions, abortQueuedAction, addAction, addMessage, equals, executeNextAction, getActions, getAllQueuedActions, getExecutingAction, getHandle, getMessages, getName, getNumberOfMessages, getPosition, getProperties, getProperty, getType, hashCode, isSelected, paint, queue, removeAction, removeAllActions, removeProperty, setName, setPosition, setProperty, setProperty, setSelected, setType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnimatedPiece

public AnimatedPiece(int handle,
                     Position position,
                     String name,
                     String type,
                     Image[] frames,
                     int delayBetweenFrames,
                     boolean repeat,
                     Animator animator)
Parameters:
handle - The piece handle.
position - The piece postion.
name - The piece name.
type - The piece type. Note that this does not affect the symbols used.
frames - The symbol used in order to animate the piece.
delayBetweenFrames - Delay between animation frames (in ms).
repeat - Should the piece animate over and over again?
animator - The animator that animates this piece.
Method Detail

getSymbol

public Image getSymbol()
Gets the Symbol attribute of the AnimatedPiece object
Overrides:
getSymbol in class Piece
Returns:
The Symbol value

startAnimation

public void startAnimation()
Description of the Method

stopAnimation

public void stopAnimation()
Stops the animation and notifies the animator that the animation is done.