apes
Class CollidableImageObject

java.lang.Object
  extended by apes.ImageObject
      extended by apes.CollidableImageObject
All Implemented Interfaces:
ICollidableObject, ILevelObject
Direct Known Subclasses:
Ape, Banana

public class CollidableImageObject
extends ImageObject
implements ICollidableObject

An ImageObject extended by the methods specified in ICollidableObject.


Field Summary
 
Fields inherited from class apes.ImageObject
image, name, position
 
Constructor Summary
CollidableImageObject(java.lang.String name, org.newdawn.slick.Image image, org.newdawn.slick.geom.Vector2f position, org.newdawn.slick.geom.Shape collisionShape)
          creates a new collidable image object.
 
Method Summary
 org.newdawn.slick.geom.Shape getCollisionShape()
          returns the collision shape of this object moved to its actual position.
 org.newdawn.slick.geom.Shape getNormalCollisionShape()
          returns the general collision shape of this object.
 boolean isCollidingWith(ICollidableObject collidable)
          returns true if the collision shape of this object intersects with the collision shape of the given object.
 void render(org.newdawn.slick.Graphics graphics)
          draws the image on the screen with its top left corner at the given x/y coordinates.
 void setPosition(org.newdawn.slick.geom.Vector2f position)
          sets the position of this object.
 
Methods inherited from class apes.ImageObject
getName, getPosition, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollidableImageObject

public CollidableImageObject(java.lang.String name,
                             org.newdawn.slick.Image image,
                             org.newdawn.slick.geom.Vector2f position,
                             org.newdawn.slick.geom.Shape collisionShape)
creates a new collidable image object.

Parameters:
name -
image -
position -
collisionShape -
Method Detail

setPosition

public void setPosition(org.newdawn.slick.geom.Vector2f position)
sets the position of this object.

Specified by:
setPosition in interface ILevelObject
Overrides:
setPosition in class ImageObject
Parameters:
position -

getNormalCollisionShape

public org.newdawn.slick.geom.Shape getNormalCollisionShape()
returns the general collision shape of this object.

Specified by:
getNormalCollisionShape in interface ICollidableObject
Returns:

getCollisionShape

public org.newdawn.slick.geom.Shape getCollisionShape()
returns the collision shape of this object moved to its actual position.

Specified by:
getCollisionShape in interface ICollidableObject
Returns:

render

public void render(org.newdawn.slick.Graphics graphics)
draws the image on the screen with its top left corner at the given x/y coordinates. If debug is enabled it will also draw its collision shape.

Specified by:
render in interface ILevelObject
Overrides:
render in class ImageObject
Parameters:
graphics -

isCollidingWith

public boolean isCollidingWith(ICollidableObject collidable)
returns true if the collision shape of this object intersects with the collision shape of the given object. It uses the shapes provided by the getCollisionShape method.

Specified by:
isCollidingWith in interface ICollidableObject
Parameters:
collidable -
Returns: