uk.ac.ic.doc.game
Interface IGameObject

All Known Implementing Classes:
RegularPolygon

public interface IGameObject

Interface for game objects. Each game object can be drawn on the screen, tested for exit from the screen and tested for collisions with other game objects.


Method Summary
 void draw(java.awt.Graphics2D graphics, Point scale)
          Draws this object on the given graphics context at the given scale.
 boolean isExitingScreen()
          Tests whether this object is exiting the screen.
 boolean isOverlapping(IGameObject object)
          Tests whether or not this object is overlapping the given object.
 void onCreate(IGame game)
          Called when the object is added to the game.
 

Method Detail

draw

void draw(java.awt.Graphics2D graphics,
          Point scale)
Draws this object on the given graphics context at the given scale. The scale provides the width and height of the game window, such that proportional positions and sizes can be converted to on-screen coordinates.

Parameters:
graphics - The graphics context on which to draw the object.
scale - The scale at which to draw the object.

isOverlapping

boolean isOverlapping(IGameObject object)
Tests whether or not this object is overlapping the given object.

Parameters:
object - The object to test for overlap with.
Returns:
True if this object is overlapping the given object, false otherwise.

isExitingScreen

boolean isExitingScreen()
Tests whether this object is exiting the screen.

Returns:
True if this object is exiting the screen, false otherwise.

onCreate

void onCreate(IGame game)
Called when the object is added to the game. Implementations of this method should register any listeners when this method is called.

Parameters:
game - The game that the object is being added to.