edu.gatech.cs2335.lemmings.physics
Class PhysicsObject

java.lang.Object
  extended byedu.gatech.cs2335.lemmings.physics.PhysicsObject
Direct Known Subclasses:
Lemming, PrettySprite

public class PhysicsObject
extends java.lang.Object

The PhysicsObject class defines the basic attributes a Physical Object has. Its methods are called by the Physics Engine to update the traits of a moving object.

Author:
Jose Caban

Constructor Summary
PhysicsObject()
          Creates a new PhysicsObject instance.
 
Method Summary
 void accelerate(PhysicsVector acceleration)
          Method accelerate No different than updateVelocity, created for clarity of code
 int getGravityUpdates()
          Method getGravityUpdates
 Point getPosition()
          Method getPosition
 PhysicsVector getVelocity()
          Method getDirection
 boolean isFalling()
          Returns true if the lemming is falling and false if it is not.
 void setGravityUpdates(int gravityUpdates)
          Describe setGravityUpdates method here.
 void setPosition(int x, int y)
          Describe setPosition method here.
 void setPosition(Point position)
          Method setPosition
 void setVelocity(PhysicsVector velocity)
          Method setDirection
 java.lang.String toString()
          Describe toString method here.
 void updatePosition(int x, int y, int z)
          Method updatePosition
 void updatePosition(Point positionn)
          Method updatePosition
 void updateVelocity(PhysicsVector vel)
          Method updateVelocity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PhysicsObject

public PhysicsObject()
Creates a new PhysicsObject instance.

Method Detail

setGravityUpdates

public final void setGravityUpdates(int gravityUpdates)
Describe setGravityUpdates method here.

Parameters:
gravityUpdates - an int value

setPosition

public final void setPosition(Point position)
Method setPosition

Parameters:
position - the location of the Physics Object relative to World

setPosition

public final void setPosition(int x,
                              int y)
Describe setPosition method here.

Parameters:
x - an int value
y - an int value

setVelocity

public final void setVelocity(PhysicsVector velocity)
Method setDirection

Parameters:
velocity - , direction/magnitude of the Physics Object

updatePosition

public final void updatePosition(Point positionn)
Method updatePosition

Parameters:
positionn - the difference in position

updatePosition

public final void updatePosition(int x,
                                 int y,
                                 int z)
Method updatePosition

Parameters:
x - the difference in the x-direction (delta X)
y - the difference in the y-direction (delta Y)
z - the difference in the z-direction (delta Z)

updateVelocity

public final void updateVelocity(PhysicsVector vel)
Method updateVelocity

Parameters:
vel - the difference in velocity

getGravityUpdates

public final int getGravityUpdates()
Method getGravityUpdates

Returns:
int , gravityUpdates for this PhysicsObject

getPosition

public final Point getPosition()
Method getPosition

Returns:
the location of the Physics Object relative to World

getVelocity

public final PhysicsVector getVelocity()
Method getDirection

Returns:
the movement direction/magnitude of the Physics Object

accelerate

public final void accelerate(PhysicsVector acceleration)
Method accelerate No different than updateVelocity, created for clarity of code

Parameters:
acceleration - the new acceleration

isFalling

public final boolean isFalling()
Returns true if the lemming is falling and false if it is not.

Returns:
a boolean value

toString

public java.lang.String toString()
Describe toString method here.

Returns:
a String value