org.deken.game.animation
Class LoopedAnimation

java.lang.Object
  extended by org.deken.game.animation.BaseAnimation
      extended by org.deken.game.animation.LoopedAnimation
All Implemented Interfaces:
java.lang.Cloneable, Animation, Updateable

public class LoopedAnimation
extends BaseAnimation

Title: LoopedAnimationStrip Description: The animation strip is looped through the sequence, with no end. Copyright: Copyright (c) 2005

Version:
1.0
Author:
Gary Deken

Field Summary
 
Fields inherited from class org.deken.game.animation.BaseAnimation
height, imageEffect, name, sequenceTime, sound, totalDuration, totalFrames, width, xOffset, yOffset
 
Constructor Summary
protected LoopedAnimation()
          Used by copy().
  LoopedAnimation(java.awt.Image image, long duration)
           
 
Method Summary
 void addFrame(java.awt.Image image, long duration)
          This adds an image to the animation strip, with a duration in milliseconds.
 LoopedAnimation copy()
          Copy Animation
 void draw(java.awt.Graphics2D graphics, int x, int y)
          Draws the current frame index to the GameGFX, including any animation offsets.
 boolean equals(java.lang.Object obj)
          Determines if two animation strips are the same, based on size of image and number of frames.
 int getCurrentFrameIndex()
           
 java.awt.Image getFrame(int i)
          This retrieves the specified frame.
 java.awt.Image getImage()
          This returns the current frame of the animated strip.
 boolean isAnimating()
          This animation strip will loop forever.
 void reset()
          This reset the animation strip, setting it to begin a new.
 void update(long elapseTime)
          This takes the elapse time, since the last update, and adds it to the total sequence time.
 
Methods inherited from class org.deken.game.animation.BaseAnimation
addImageEffect, baseUpdate, copyParent, getHeight, getName, getSound, getTotalDuration, getWidth, getXOffset, getYOffset, setName, setOffsets, setSound
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoopedAnimation

public LoopedAnimation(java.awt.Image image,
                       long duration)
Parameters:
image - Image
duration - long

LoopedAnimation

protected LoopedAnimation()
Used by copy().

Method Detail

addFrame

public void addFrame(java.awt.Image image,
                     long duration)
This adds an image to the animation strip, with a duration in milliseconds.

Parameters:
image - Image
duration - long

draw

public void draw(java.awt.Graphics2D graphics,
                 int x,
                 int y)
Draws the current frame index to the GameGFX, including any animation offsets.

Parameters:
graphics -
x -
y -

equals

public boolean equals(java.lang.Object obj)
Determines if two animation strips are the same, based on size of image and number of frames.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object
Returns:
boolean

reset

public void reset()
This reset the animation strip, setting it to begin a new.


update

public void update(long elapseTime)
This takes the elapse time, since the last update, and adds it to the total sequence time. If the duration is exceeded for a frame, the current frame index is increased.

Parameters:
elapseTime - long

getCurrentFrameIndex

public int getCurrentFrameIndex()

getFrame

public java.awt.Image getFrame(int i)
This retrieves the specified frame.

Parameters:
i - int
Returns:
AnimatedImageFrame

getImage

public java.awt.Image getImage()
This returns the current frame of the animated strip.

Returns:
Image

isAnimating

public boolean isAnimating()
This animation strip will loop forever. This method will always return true.

Returns:
boolean

copy

public LoopedAnimation copy()
Copy Animation

Returns:
LoopedAnimationStrip