|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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 |
---|
void actOnCollision(Collidable object)
object
- the Collidable object that the current object has collided withdouble getXVelocity()
double getYVelocity()
void setVelocity(double vx, double vy)
vx
- x component of the velocityvy
- y component of the velocitydouble getX()
double getY()
void setLocation(double x, double y)
x
- x coordinatey
- y coordinate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |