gizmoball.gameworld
Class GameObject

java.lang.Object
  extended by gizmoball.gameworld.GameObject
Direct Known Subclasses:
Ball, Gizmo

public abstract class GameObject
extends java.lang.Object

This is the base interface of every object that is in the game world, such as gizmos and balls.

Specification Fields

Constructor Summary
GameObject()
           
 
Method Summary
abstract  GameObject copy()
          Returns a copy of this GameObject.
abstract  Vect3Pair getBoundingBox()
          Returns the bounding box of this
abstract  java.util.List<Trigger> getDefaultTriggers()
          Returns the list of triggers that this gameobject needs to function.
abstract  GraphicsProperties getGraphicsProperties()
          Returns an object that holds the information necessary for drawing this object.
abstract  java.lang.String getXMLString(java.lang.String name)
          returns the XML string that would be used to save this game object
 java.lang.String toString()
           
abstract  void update(double dt)
          This has the GameObject update its internal state, to move forward in time by an amount dt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameObject

public GameObject()
Method Detail

update

public abstract void update(double dt)
This has the GameObject update its internal state, to move forward in time by an amount dt. It is very important that the state variables used for this calculation are the same values as available before the calculation. For instance, when a ball is moving under the influence of gravity, update() must first move the ball, then update the velocity. This way if you try to externally calculate where the ball will be in a time dt, this will also be the position of the ball in time dt.

Parameters:
dt - the amount to move forward in time
Effects:
the internal state is progressed forward through time by an amount dt (such as moving a distance v*dt)
Modifies:
this

copy

public abstract GameObject copy()
Returns a copy of this GameObject. It is not just a shallow copy, but not necessarily a complete deep copy. Some things are guaranteed to be deep copied, such as balls. Some things, like references to gizmos, should not and will not be copied.

Returns:
a copy of this

getGraphicsProperties

public abstract GraphicsProperties getGraphicsProperties()
Returns an object that holds the information necessary for drawing this object. Making changes to this object changes the underlying object, so those changes will be reflected in the drawer.

Returns:
all the information needed to draw this object.

getXMLString

public abstract java.lang.String getXMLString(java.lang.String name)
returns the XML string that would be used to save this game object

Returns:
String s where s is sufficient to be directly inserted into an XML file where game world information is being saved

getBoundingBox

public abstract Vect3Pair getBoundingBox()
Returns the bounding box of this

Returns:
a Vect3Pair containing the coordinates of opposite corners of the box

getDefaultTriggers

public abstract java.util.List<Trigger> getDefaultTriggers()
Returns the list of triggers that this gameobject needs to function. It should be returned in a form such that it can be added directly to the world state.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
the XML string for this GameObject