gizmoball.gameworld.gameobjects
Class BeamBall

java.lang.Object
  extended by gizmoball.gameworld.GameObject
      extended by gizmoball.gameworld.gameobjects.Ball
          extended by gizmoball.gameworld.gameobjects.SimpleBall
              extended by gizmoball.gameworld.gameobjects.BeamBall

public class BeamBall
extends SimpleBall

A ball that represents a beam. This is done by having a very fast ball as its physics model, but have a separate model for graphics that looks like a beam.


Constructor Summary
BeamBall(Vect3 position, Vect3 velocity, double timeAlive, double length, GameWorldState ws)
          Creates a new BeamBall
 
Method Summary
 BeamBall copy()
          Returns a copy of this GameObject.
 GraphicsProperties getGraphicsProperties()
          Returns an object that holds the information necessary for drawing this object.
 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 gizmoball.gameworld.gameobjects.SimpleBall
getBoundingBox, getDefaultTriggers, getGravity, getSphere, getXMLString, setFriction, setGravity, setPosition, setVelocity
 
Methods inherited from class gizmoball.gameworld.GameObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeamBall

public BeamBall(Vect3 position,
                Vect3 velocity,
                double timeAlive,
                double length,
                GameWorldState ws)
Creates a new BeamBall

Parameters:
position - the initial position of the ball, which is also one end of the beam
velocity - the velocity of the actual ball
timeAlive - after this amount of time, the beam will remove itself from the WorldState
length - the length of the beam
ws - the WorldState that this BeamBall should remove itself from
Method Detail

update

public void update(double dt)
Description copied from class: GameObject
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.

Overrides:
update in class SimpleBall
Parameters:
dt - the amount to move forward in time

getGraphicsProperties

public GraphicsProperties getGraphicsProperties()
Description copied from class: GameObject
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.

Overrides:
getGraphicsProperties in class SimpleBall
Returns:
all the information needed to draw this object.

copy

public BeamBall copy()
Description copied from class: GameObject
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.

Overrides:
copy in class SimpleBall
Returns:
a copy of this