vooga.engine.collision
Interface Collidable


public interface Collidable

This interface must be implemented by active/movable objects involved in a game to ensure that the collision manager is able to interact with the objects and detect collisions correctly and properly. It allows a game designer to specify how each object behaves upon collision, possibly define different behavior for different types of objects that the current one collides with. It also forces the implementation of useful methods that are necessary in calculation post collision behavior.


Method Summary
 void actOnCollision(Collidable object)
          This method is called whenever an object comes into contact with another.
 double getX()
           
 double getXVelocity()
           
 double getY()
           
 double getYVelocity()
           
 void setLocation(double x, double y)
          Set the location of this object
 void setVelocity(double vx, double vy)
          Set the velocity of this object
 

Method Detail

actOnCollision

void actOnCollision(Collidable object)
This method is called whenever an object comes into contact with another. It determines the post collision behavior of this object according to what kind of object it collides with. This can be customized when an object implements it and allows for the implementation to extract information about the object it collides with.

Parameters:
object - the Collidable object that the current object has collided with

getXVelocity

double getXVelocity()
Returns:
x component of the velocity of this object

getYVelocity

double getYVelocity()
Returns:
y component of the velocity of this object

setVelocity

void setVelocity(double vx,
                 double vy)
Set the velocity of this object

Parameters:
vx - x component of the velocity
vy - y component of the velocity

getX

double getX()
Returns:
x coordinate of this object

getY

double getY()
Returns:
y coordinate of this object

setLocation

void setLocation(double x,
                 double y)
Set the location of this object

Parameters:
x - x coordinate
y - y coordinate