com.brackeen.javagamebook.graphics
Class Sprite

java.lang.Object
  extended bycom.brackeen.javagamebook.graphics.Sprite

public class Sprite
extends java.lang.Object


Constructor Summary
Sprite(Animation anim)
          Creates a new Sprite object with the specified Animation.
 
Method Summary
 java.lang.Object clone()
          Clones this Sprite.
 int getHeight()
          Gets this Sprite's height, based on the size of the current image.
 java.awt.Image getImage()
          Gets this Sprite's current image.
 float getVelocityX()
          Gets the horizontal velocity of this Sprite in pixels per millisecond.
 float getVelocityY()
          Gets the vertical velocity of this Sprite in pixels per millisecond.
 int getWidth()
          Gets this Sprite's width, based on the size of the current image.
 float getX()
          Gets this Sprite's current x position.
 float getY()
          Gets this Sprite's current y position.
 void setVelocityX(float dx)
          Sets the horizontal velocity of this Sprite in pixels per millisecond.
 void setVelocityY(float dy)
          Sets the vertical velocity of this Sprite in pixels per millisecond.
 void setX(float x)
          Sets this Sprite's current x position.
 void setY(float y)
          Sets this Sprite's current y position.
 void update(long elapsedTime)
          Updates this Sprite's Animation and its position based on the velocity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sprite

public Sprite(Animation anim)
Creates a new Sprite object with the specified Animation.

Method Detail

update

public void update(long elapsedTime)
Updates this Sprite's Animation and its position based on the velocity.


getX

public float getX()
Gets this Sprite's current x position.


getY

public float getY()
Gets this Sprite's current y position.


setX

public void setX(float x)
Sets this Sprite's current x position.


setY

public void setY(float y)
Sets this Sprite's current y position.


getWidth

public int getWidth()
Gets this Sprite's width, based on the size of the current image.


getHeight

public int getHeight()
Gets this Sprite's height, based on the size of the current image.


getVelocityX

public float getVelocityX()
Gets the horizontal velocity of this Sprite in pixels per millisecond.


getVelocityY

public float getVelocityY()
Gets the vertical velocity of this Sprite in pixels per millisecond.


setVelocityX

public void setVelocityX(float dx)
Sets the horizontal velocity of this Sprite in pixels per millisecond.


setVelocityY

public void setVelocityY(float dy)
Sets the vertical velocity of this Sprite in pixels per millisecond.


getImage

public java.awt.Image getImage()
Gets this Sprite's current image.


clone

public java.lang.Object clone()
Clones this Sprite. Does not clone position or velocity info.