game.core
Class Sprite

java.lang.Object
  extended by game.core.Sprite
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Asteroid, BigShield, Bullet, PowerSprite, Rocket, Star

public class Sprite
extends java.lang.Object
implements java.lang.Cloneable

a Sprite - an object that moves around in a game


Field Summary
protected  double age
          The age of this Sprite
protected  double dx
          The velocity of the sprite
protected  double dy
          The velocity of the sprite
 double r
          The radius of the sprite
protected  double x
          the position of the sprite
protected  double y
          the position of the sprite
 
Constructor Summary
Sprite(double x, double y, double dx, double dy, double r)
          constructs a sprite with the given characteristics
 
Method Summary
 java.lang.Object clone()
           
 double getDX()
           
 double getDY()
           
 double getSize()
           
 double getX()
           
 double getY()
           
 boolean touches(Sprite sp, java.awt.Rectangle rr)
          returns true if the this Sprite is touching the other
 void updatePositionWrap(java.awt.Rectangle r)
          updates the position of this sprite, bounding it within the given Rectangle by wrapping the Rectangle into a torus
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

protected double x
the position of the sprite


y

protected double y
the position of the sprite


dx

protected double dx
The velocity of the sprite


dy

protected double dy
The velocity of the sprite


r

public double r
The radius of the sprite


age

protected double age
The age of this Sprite

Constructor Detail

Sprite

public Sprite(double x,
              double y,
              double dx,
              double dy,
              double r)
constructs a sprite with the given characteristics

Method Detail

touches

public boolean touches(Sprite sp,
                       java.awt.Rectangle rr)
returns true if the this Sprite is touching the other


updatePositionWrap

public void updatePositionWrap(java.awt.Rectangle r)
updates the position of this sprite, bounding it within the given Rectangle by wrapping the Rectangle into a torus


clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getX

public double getX()

getY

public double getY()

getDX

public double getDX()

getDY

public double getDY()

getSize

public double getSize()