|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ICollision
Every MoveableGameObject that wants to do something with tile collisions
needs to implement this interface. The GameEngine will check for tile collisions
for MoveableGameObjects that implement this interface.
It will do no checking for MoveableGameObjects that don't implement
this interface. This increases performance of the game.
Tile collision is totally separate from collision with other GameObjects,
which can always be checked by calling the getCollidedObjects() method
in your update() of the MoveableGameObject.
Note: It is useless to let classes other than MoveableGameObjects implement
this interface. Nothing will happen if you do ;-)!
Method Summary | |
---|---|
void |
collisionOccurred(java.util.List<TileCollision> collidedTiles)
This method will be triggered when there have been collisions with tiles. |
Method Detail |
---|
void collisionOccurred(java.util.List<TileCollision> collidedTiles)
Collision detection does not change the position
of the MoveableGameObject. If you don't do anything, objects will fly through
walls. Use methods like undoMove, bounce, moveUpToTileSide to react.
Typically, you scan the list front to end and take action on the first collision
that is interesting and discard the rest.
collidedTiles
- List of TileCollision holding all tile collisions in this move.TileCollision
,
MoveableGameObject.undoMove()
,
MoveableGameObject.bounce(TileCollision)
,
MoveableGameObject.moveUpToTileSide(TileCollision)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |