tipgame.game.gammacentauri.tracker
Class EnemyBulletTracker

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

public class EnemyBulletTracker
extends java.lang.Object
implements Tracker

Tracks and moves an enemy's bullet.

Author:
Tom James

Field Summary
private  int height
           
private  boolean homing
          Whether or not the bullet is homing.
private  java.awt.geom.Point2D.Double location
          The location of the bullet.
(package private)  int player
           
private  double velocityX
          The horizontal velocity of the bullet.
private  double velocityY
          The vertical velocity of the bullet.
private  int width
           
 
Constructor Summary
EnemyBulletTracker(double x, double y, double velocityX, double velocityY, int width, int height, boolean homing, int player)
          Constructs a bullet 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 setHoming(boolean homing)
          Sets whether or not the bullet is homing.
 void setLocation(java.awt.geom.Point2D.Double point)
          Sets the location of the bullet to a given point.
 void setTargetPlayer(int player)
           
 void setVelocityX(double velocityX)
          Sets the horizontal velocity of the bullet to the given velocity.
 void setVelocityY(double velocityY)
          Sets the vertical velocity of the bullet to the given velocity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

homing

private boolean homing
Whether or not the bullet is homing.


location

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


velocityX

private double velocityX
The horizontal velocity of the bullet.


velocityY

private double velocityY
The vertical velocity of the bullet.


width

private int width

height

private int height

player

int player
Constructor Detail

EnemyBulletTracker

public EnemyBulletTracker(double x,
                          double y,
                          double velocityX,
                          double velocityY,
                          int width,
                          int height,
                          boolean homing,
                          int player)
Constructs a bullet given an x-coordinate, y-coordinate, horizontal velocity, and vertical velocity.

Parameters:
x - The x-coordinate of the bullet.
y - The y-coordinate of the bullet.
velocityX - The horizontal velocity of the bullet.
velocityY - The vertical velocity of the bullet.
homing - Whether or not the bullet is homing.
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 bullet to a given point.

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

setHoming

public void setHoming(boolean homing)
Sets whether or not the bullet is homing.

Parameters:
homing - Whether or not the bullet is homing.

setTargetPlayer

public void setTargetPlayer(int player)

setVelocityX

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

Parameters:
velocityX - The horizontal velocity of the bullet.

getVelocityX

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

setVelocityY

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

Parameters:
velocityY - The vertical velocity of the bullet.

getVelocityY

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

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