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 |
actionQueue, actions, currentAction, handle, MAX_MESSAGES, messages, name, position, properties, selected, type |
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 |
Methods inherited from class java.lang.Object |
, clone, finalize, getClass, notify, notifyAll, registerNatives, toString, wait, wait, wait |
frames
Image[] frames
- Description of the Field
delayBetweenFrames
int delayBetweenFrames
- Description of the Field
repeat
boolean repeat
- Description of the Field
animator
Animator animator
- Description of the Field
currentFrame
int currentFrame
- Description of the Field
animationThread
Thread animationThread
- Description of the Field
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.
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.