physics
Class GravityMotion

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

public class GravityMotion
extends IMotion

GravityMotion.java Created: Thu Nov 11 13:30:05 2004

Version:
A IMotion that mimics gravity
Author:

Constructor Summary
GravityMotion(CollisionObject colOb)
          Creates a new GravityMotion instance.
 
Method Summary
 void bounce(CollisionObject co)
          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)
          Set the DX direction
 void setDY(int dy)
          Sets the DY direction
 void setGravity(int g)
          Override to do something useful
 void setVelocity(int dx, int dy, int speed)
          Sets the velocity of the motion
 void start()
          Starts the MotionTimer for this motion
 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, setLocation, switchMomentum
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GravityMotion

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

Parameters:
colOb - a CollisionObject value
Method Detail

setGravity

public void setGravity(int g)
Description copied from class: IMotion
Override to do something useful

Overrides:
setGravity in class IMotion
Parameters:
g - an int value

setVelocity

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

Specified by:
setVelocity in class IMotion
Parameters:
dx - - change in x direction
dy - - change in y direction
speed - - Timer delay

getSpeed

public int getSpeed()
Returns the speed of the motion

Specified by:
getSpeed in class IMotion
Returns:
the timer delay

getDX

public int getDX()
Returns dx of the velocity

Specified by:
getDX in class IMotion
Returns:
the change in x direction

getDY

public int getDY()
Returns dy of the velocity

Specified by:
getDY in class IMotion
Returns:
the change in y direction

timerReact

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

Specified by:
timerReact in class IMotion

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 co)
A bounce for this motion

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

setDX

public void setDX(int dx)
Set the DX direction

Specified by:
setDX in class IMotion

setDY

public void setDY(int dy)
Sets the DY direction

Specified by:
setDY in class IMotion