physics
Class StraightMotion

java.lang.Object
  extended by physics.IMotion
      extended by physics.StraightMotion

public class StraightMotion
extends IMotion

StraightMotion.java Created: Sat Sep 18 20:30:34 2004

Version:
A motion that travels in straight lines
Author:

Constructor Summary
StraightMotion(CollisionObject colOb)
          Creates a new StraightMotion instance.
 
Method Summary
 void bounce(CollisionObject col)
          A bounce for this motion
 int getDX()
          Returns dx of the velocity
 int getDY()
          Returns dy of the velocity
 int getSpeed()
          Returns the speed of the motion
 void setDX(int dx)
          Sets the DX of the motion
 void setDY(int dy)
          Sets the DY of the motion
 void setTimer(MotionTimer mt)
          Sets the MotionTimer for this motion
 void setVelocity(int dx, int dy, int speed)
          Sets the velocity of the motion
 void start()
          Starts the MotionTimer for this motion
 void stillCollide(CollisionObject col)
          Check to see if the object with this motion and col are still colliding and if so move them apart
 void stop()
          Stops the MotionTimer for this object
 void timerReact()
          Moves the object at intervals decided by the timer and checks for collisions
 
Methods inherited from class physics.IMotion
changeMomentum, getCollided, getVelocity, setCoefficient, setDX, setDY, setGravity, setLocation, switchMomentum
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StraightMotion

public StraightMotion(CollisionObject colOb)
Creates a new StraightMotion instance.

Parameters:
colOb - a CollisionObject value
Method Detail

setVelocity

public void setVelocity(int dx,
                        int dy,
                        int speed)
Sets the velocity of the motion

Specified by:
setVelocity in class IMotion
Parameters:
dx - an int value
dy - an int value
speed - an int value

setDX

public void setDX(int dx)
Sets the DX of the motion

Specified by:
setDX in class IMotion
Parameters:
dx - an int value
speed - an int value

setDY

public void setDY(int dy)
Sets the DY of the motion

Specified by:
setDY in class IMotion
Parameters:
dy - an int value
speed - an int value

getSpeed

public int getSpeed()
Returns the speed of the motion

Specified by:
getSpeed in class IMotion
Returns:
an int value

getDX

public int getDX()
Returns dx of the velocity

Specified by:
getDX in class IMotion
Returns:
an int value

getDY

public int getDY()
Returns dy of the velocity

Specified by:
getDY in class IMotion
Returns:
an int value

timerReact

public void timerReact()
Moves the object at intervals decided by the timer and checks for collisions

Specified by:
timerReact in class IMotion

setTimer

public void setTimer(MotionTimer mt)
Sets the MotionTimer for this motion


start

public void start()
Starts the MotionTimer for this motion

Specified by:
start in class IMotion

stop

public void stop()
Stops the MotionTimer for this object

Specified by:
stop in class IMotion

bounce

public void bounce(CollisionObject col)
A bounce for this motion

Specified by:
bounce in class IMotion
Parameters:
col - a CollisionObject value

stillCollide

public void stillCollide(CollisionObject col)
Check to see if the object with this motion and col are still colliding and if so move them apart

Parameters:
col - a CollisionObject value