vooga.gameEngine.item
Interface Collidable<T>
- All Superinterfaces:
- java.lang.Comparable<Renderable>, Renderable, Tangible
- All Known Implementing Classes:
- Alien, Ball, Ball, Ball, Barrier, Barrier, Block, Bomb, Box, EnemyShip, Explosion, ImageObstacle, InfoBar, Laser, Missle, Paddle, PaddleLeft, PaddleRight, Platform, Powerup, Projectile, ReducePaddlePowerup, RobotUnicorn, Ship, TerrainPiece, TestSquare, UFO, Worm
public interface Collidable<T>
- extends Renderable
A object that implements Collidable
is checked every game cycle
to make sure it is not touching any other Collidable
object of
the given type. If the object is touching another Collidable
object of the specified type then the collide
method will be
called.
For example, if your GameItem
implements
Collidable<GameItem>
then you will need to write the
collide(GameItem otherObject)
, which will be called whenever
this object collides with any other GameItem. If you want to make your
GameItem
only collide with a specific type of object such as a
PowerUp
, then you would implement
Collidable<PowerUp>
and write a
collide(PowerUp otherObject)
method.
- Author:
- Justin C. Klaassen
Method Summary |
void |
collide(T otherObject)
This method is called whenever an object of the specified type has
collided with this object. |
Methods inherited from interface java.lang.Comparable |
compareTo |
collide
void collide(T otherObject)
- This method is called whenever an object of the specified type has
collided with this object.
- Parameters:
otherObject
- that has collided with this object