org.deken.game.animation
Class BaseAnimation

java.lang.Object
  extended by org.deken.game.animation.BaseAnimation
All Implemented Interfaces:
java.lang.Cloneable, Animation, Updateable
Direct Known Subclasses:
BounceAnimation, BounceOnceAnimation, DissolveAnimation, EllipseShapeAnimation, LayeredAnimation, LoopedAnimation, OnceAnimation, RandomAnimation, RectangleShapeAnimation, StaticAnimation, TileAnimation

public abstract class BaseAnimation
extends java.lang.Object
implements Animation

Title: BaseAnimation

Description: The BaseAnimation implements the basic features of the animation. Describing its size, off sets, sound integration and image effect. The ImageEffect is defaulted to NoImageEffect. The sounds is a TimeListeningSound, that will be updated in the baseUpdate() method, which all animations should call.

Copyright: Copyright (c) Sep 4, 2011

Version:
1.0
Author:
Gary Deken

Field Summary
protected  int height
           
protected  ImageEffect imageEffect
           
protected  java.lang.String name
           
protected  long sequenceTime
           
protected  TimeListeningSound sound
           
protected  long totalDuration
           
protected  int totalFrames
           
protected  int width
           
protected  int xOffset
           
protected  int yOffset
           
 
Constructor Summary
BaseAnimation()
           
 
Method Summary
 void addImageEffect(ImageEffect imageEffect)
          This method is for adding an ImageSFX (special effect) to the animation.
protected  void baseUpdate(long elapseTime)
           
protected  BaseAnimation copyParent(BaseAnimation newStrip)
           
 int getHeight()
          Returns the height of this animation strip.
 java.lang.String getName()
           
 Sound getSound()
          Returns the sound for this animation.
 long getTotalDuration()
           
 int getWidth()
          Returns the width of this animation strip.
 int getXOffset()
          returns the Offset of the image in the X direction.
 int getYOffset()
          returns the Offset of the image in the Y direction.
 void setName(java.lang.String name)
          Name is used for debugging.
 void setOffsets(int x, int y)
          Sets the offset of the image, so that it displays ideally on the screen.
 void setSound(TimeListeningSound sound)
          Sound element associated with this animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deken.game.animation.Animation
addFrame, copy, draw, getFrame, getImage, isAnimating, reset, update
 

Field Detail

height

protected int height

imageEffect

protected ImageEffect imageEffect

name

protected java.lang.String name

width

protected int width

xOffset

protected int xOffset

yOffset

protected int yOffset

sequenceTime

protected long sequenceTime

sound

protected TimeListeningSound sound

totalFrames

protected int totalFrames

totalDuration

protected long totalDuration
Constructor Detail

BaseAnimation

public BaseAnimation()
Method Detail

addImageEffect

public void addImageEffect(ImageEffect imageEffect)
Description copied from interface: Animation
This method is for adding an ImageSFX (special effect) to the animation.

Specified by:
addImageEffect in interface Animation
Parameters:
imageEffect -

getHeight

public int getHeight()
Returns the height of this animation strip.

Specified by:
getHeight in interface Animation
Returns:
int

getName

public java.lang.String getName()
Specified by:
getName in interface Updateable
Returns:

getSound

public Sound getSound()
Returns the sound for this animation. This is useful for getting the sound for stopping it.

Specified by:
getSound in interface Animation
Returns:
Sound

getTotalDuration

public long getTotalDuration()
Specified by:
getTotalDuration in interface Animation

getWidth

public int getWidth()
Returns the width of this animation strip.

Specified by:
getWidth in interface Animation
Returns:
int

getXOffset

public int getXOffset()
Description copied from interface: Animation
returns the Offset of the image in the X direction.

Specified by:
getXOffset in interface Animation
Returns:
int

getYOffset

public int getYOffset()
Description copied from interface: Animation
returns the Offset of the image in the Y direction.

Specified by:
getYOffset in interface Animation
Returns:
int

setName

public void setName(java.lang.String name)
Name is used for debugging.

Specified by:
setName in interface Animation
Parameters:
name - String

setSound

public void setSound(TimeListeningSound sound)
Description copied from interface: Animation
Sound element associated with this animation. Start is the delta time that the sound should start playing at.

Specified by:
setSound in interface Animation
Parameters:
sound -

setOffsets

public void setOffsets(int x,
                       int y)
Description copied from interface: Animation
Sets the offset of the image, so that it displays ideally on the screen. This should default to zero.

Specified by:
setOffsets in interface Animation
Parameters:
x -
y -

copyParent

protected BaseAnimation copyParent(BaseAnimation newStrip)
Parameters:
newStrip -
Returns:
BaseAnimation

baseUpdate

protected void baseUpdate(long elapseTime)