tipgame.game.gammacentauri.tracker
Class EnemyTracker

java.lang.Object
  extended by tipgame.game.gammacentauri.tracker.EnemyTracker
All Implemented Interfaces:
Tracker

public class EnemyTracker
extends java.lang.Object
implements Tracker

Tracks and moves an enemy.

Author:
Tom James

Field Summary
private  int height
           
private  java.awt.geom.Point2D.Double location
          The location of the enemy.
private  double velocityX
          The horizontal velocity of the enemy.
private  double velocityY
          The vertical velocity of the enemy.
private  int width
           
 
Constructor Summary
EnemyTracker(double x, double y, double velocityX, double velocityY, int width, int height)
          Constructs an enemy given an x-coordinate, y-coordinate, horizontal velocity, and vertical velocity.
 
Method Summary
 void advanceTime(double time)
          called every time time is advanced.
 java.awt.geom.Point2D.Double getLocation()
          determines the absolute location (i.e.
 double getRotationAddition()
          determines the relative rotation.
 double getScaleFactor()
          determines the relative scaling factor.
 double getVelocityX()
           
 double getVelocityY()
           
 void setLocation(java.awt.geom.Point2D.Double point)
          Sets the location of the enemy to a given point.
 void setVelocityX(double velocityX)
          Sets the horizontal velocity of the enemy to the given velocity.
 void setVelocityY(double velocityY)
          Sets the vertical velocity of the enemy to the given velocity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

location

private java.awt.geom.Point2D.Double location
The location of the enemy.


velocityX

private double velocityX
The horizontal velocity of the enemy.


velocityY

private double velocityY
The vertical velocity of the enemy.


width

private int width

height

private int height
Constructor Detail

EnemyTracker

public EnemyTracker(double x,
                    double y,
                    double velocityX,
                    double velocityY,
                    int width,
                    int height)
Constructs an enemy given an x-coordinate, y-coordinate, horizontal velocity, and vertical velocity.

Parameters:
x - The x-coordinate of the enemy.
y - The y-coordinate of the enemy.
velocityX - The horizontal velocity of the enemy.
velocityY - The vertical velocity of the enemy.
Method Detail

getLocation

public java.awt.geom.Point2D.Double getLocation()
Description copied from interface: Tracker
determines the absolute location (i.e. not necessarily relative to the Sprite's last location)

Specified by:
getLocation in interface Tracker
Returns:
the absolute location of the Sprite

setLocation

public void setLocation(java.awt.geom.Point2D.Double point)
Sets the location of the enemy to a given point.

Parameters:
point - The point to which the enemy will be moved.

setVelocityX

public void setVelocityX(double velocityX)
Sets the horizontal velocity of the enemy to the given velocity.

Parameters:
velocityX - The horizontal velocity of the enemy.

getVelocityX

public double getVelocityX()
Returns:
The horizontal velocity of the enemy.

setVelocityY

public void setVelocityY(double velocityY)
Sets the vertical velocity of the enemy to the given velocity.

Parameters:
velocityY - The vertical velocity of the enemy.

getVelocityY

public double getVelocityY()
Returns:
The vertical velocity of the enemy.

getScaleFactor

public double getScaleFactor()
Description copied from interface: Tracker
determines the relative scaling factor. This method will take the current size of the Sprite and scale it by the factor returned

Specified by:
getScaleFactor in interface Tracker
Returns:
the multiplicative scaling factor

getRotationAddition

public double getRotationAddition()
Description copied from interface: Tracker
determines the relative rotation. This method will take the current orientation and rotate it by the value returned.

Specified by:
getRotationAddition in interface Tracker
Returns:
the amount to rotate in radians

advanceTime

public void advanceTime(double time)
Description copied from interface: Tracker
called every time time is advanced. The amount of time which has passed since the last call. This method must also accept negative time intervals for reversing time. The magnitude of the negative time interval will not exceed the magnitude of the last positive time interval. Also, the keyboard and mouse inputs will remain constant when the interval is negative.

Specified by:
advanceTime in interface Tracker
Parameters:
time - the time in seconds since the last frame