org.deken.game.motion
Class SingleMotion

java.lang.Object
  extended by org.deken.game.motion.BaseMotion
      extended by org.deken.game.motion.SingleMotion
All Implemented Interfaces:
Motion

public class SingleMotion
extends BaseMotion

Title: SingleMotion

Description: This animates a game piece with a single motion. The motion is the same, regardless of the direction of the game piece.

Copyright: Copyright (c) 2005

Version:
1.0
Author:
Gary Deken

Field Summary
 
Fields inherited from class org.deken.game.motion.BaseMotion
boundingBox, boundingBoxSet
 
Constructor Summary
protected SingleMotion()
          Used by copy().
  SingleMotion(Animation animation)
          SingleMotion
 
Method Summary
 SingleMotion copy()
          Copies the Motion.
 void draw(java.awt.Graphics2D graphics, int x, int y)
          This method gets the current animation and draws it.
 Animation[] getAnimations()
          Returns the Animations that make up this Motion
 float getDirection()
          Returns the direction of the Motion.
 java.awt.Image getImage()
          This returns the current Image of the Animation for this motion.
 java.lang.String getName()
          The method returns the name of this Motion.
 void reset()
          This reset the Animation, setting it to begin a new.
 void setDirection(float direction)
          This method is not used.
 void setName(java.lang.String name)
          Sets the name for the Motion.
 void update(long elapseTime, float direction)
          This takes the elapse time and GameVector, by calling setGameVector() and the update() of the Animation.
 
Methods inherited from class org.deken.game.motion.BaseMotion
getBounds, isBoundsSet, setBoundingBox, setBoundingBox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleMotion

public SingleMotion(Animation animation)
SingleMotion

Parameters:
animation - Animation

SingleMotion

protected SingleMotion()
Used by copy().

Method Detail

copy

public SingleMotion copy()
Copies the Motion.

Returns:
SingleMotion

draw

public void draw(java.awt.Graphics2D graphics,
                 int x,
                 int y)
Description copied from interface: Motion
This method gets the current animation and draws it. The animation that is retrieved from is based on the direction the game pieces is facing. When it is used with the update method, it will draw each image in the sequence as it is updated.

Parameters:
graphics -
x -
y -

getAnimations

public Animation[] getAnimations()
Description copied from interface: Motion
Returns the Animations that make up this Motion

Returns:
Animation[]

getDirection

public float getDirection()
Description copied from interface: Motion
Returns the direction of the Motion.

Returns:
float

getImage

public java.awt.Image getImage()
This returns the current Image of the Animation for this motion.

Returns:
Image

getName

public java.lang.String getName()
Description copied from interface: Motion
The method returns the name of this Motion.

Returns:

reset

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


setDirection

public void setDirection(float direction)
This method is not used.

Parameters:
direction - float

setName

public void setName(java.lang.String name)
Description copied from interface: Motion
Sets the name for the Motion.


update

public void update(long elapseTime,
                   float direction)
This takes the elapse time and GameVector, by calling setGameVector() and the update() of the Animation.

Parameters:
elapseTime - long
direction -