gizmoball.gameworld.gameobjects
Class Flipper

java.lang.Object
  extended by gizmoball.gameworld.GameObject
      extended by gizmoball.gameworld.Gizmo
          extended by gizmoball.gameworld.gameobjects.Flipper

public class Flipper
extends Gizmo

A flipper. It flips up, and then falls back down. The flipper rotates in the XY-plane only.

Specification Fields

Field Summary
 
Fields inherited from class gizmoball.gameworld.Gizmo
orientation, totalTranslation
 
Constructor Summary
Flipper(Vect3 upFrontLeftCorner, double length, double depth, double rotateDistance, double rotationSpeed, double rotateDirection)
          Creates a new Flipper from XML parameters
Flipper(Vect3 pivot, Vect3 tip, double rotateDistance, double rotationSpeed, double rotateDirection)
          Constructs a new Flipper.
 
Method Summary
 void doActivate()
          Immediately "activates" this gizmo.
 void doUpdate(double dt)
          The same as GameObject.update().
 Vect3Pair getBoundingBox()
          Returns the bounding box of this
protected  java.lang.String getCoeffReflectionString()
          Need to override the Gizmo getCoeffReflectionString because Flipper's default coefficient of reflection is 0.95
 GraphicsProperties getGraphicsProperties()
          Returns an object that holds the information necessary for drawing this object.
 PhysicsModel getPhysicsModel()
          Returns the physical model of this gizmo.
 java.lang.String getXMLString(java.lang.String name)
          returns the XML string that would be used to save this game object
 void rotateAboutAxis(Vect3 center, Vect3 axis, double angle)
          Rotates this
 void translateBy(Vect3 v)
          Translates this
 
Methods inherited from class gizmoball.gameworld.Gizmo
activate, copy, getColorString, getCommonAttributesString, getDefaultTriggers, getOrientationDoubleString, getOrientationString, getReflectionCoeff, getTextureString, getTranslationString, getXMLDelay, getXMLDelayString, setCoefficientOfReflection, setCommonAttributes, setDelay, update
 
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

Flipper

public Flipper(Vect3 upFrontLeftCorner,
               double length,
               double depth,
               double rotateDistance,
               double rotationSpeed,
               double rotateDirection)
Creates a new Flipper from XML parameters

Parameters:
upFrontLeftCorner - the top left corner
length - the length of the flipper
depth - the depth of the flipper
rotateDistance - how far the flipper rotates
rotationSpeed - the rotation speed
rotateDirection - the direction of rotation

Flipper

public Flipper(Vect3 pivot,
               Vect3 tip,
               double rotateDistance,
               double rotationSpeed,
               double rotateDirection)
Constructs a new Flipper. It has constant cross-sections in the xy plane.

Parameters:
pivot - the pivot point of the flipper, ie the point around which it rotates. specifies one of the z-coordinates
tip - the tip of the flipper; the pivot and tip specify the position and orientation (the tip is not the very end of the flipper, but in that direction). specifies the other z-coordinate.
Method Detail

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.

Specified by:
getGraphicsProperties in class GameObject
Returns:
all the information needed to draw this object.

doActivate

public void doActivate()
Description copied from class: Gizmo
Immediately "activates" this gizmo. The definition of "activate" varies from gizmo to gizmo.

Specified by:
doActivate in class Gizmo
Effects:
sets the flipper to flipping mode

getPhysicsModel

public PhysicsModel getPhysicsModel()
Description copied from class: Gizmo
Returns the physical model of this gizmo. The model stores the structure, as well as velocity, rotation, and rotation of this gizmo.

Specified by:
getPhysicsModel in class Gizmo
Returns:
this.physicsModel

getXMLString

public java.lang.String getXMLString(java.lang.String name)
Description copied from class: GameObject
returns the XML string that would be used to save this game object

Specified by:
getXMLString in class GameObject
Returns:
String s where s is sufficient to be directly inserted into an XML file where game world information is being saved

getCoeffReflectionString

protected java.lang.String getCoeffReflectionString()
Need to override the Gizmo getCoeffReflectionString because Flipper's default coefficient of reflection is 0.95

Overrides:
getCoeffReflectionString in class Gizmo

doUpdate

public void doUpdate(double dt)
Description copied from class: Gizmo
The same as GameObject.update().

Specified by:
doUpdate in class Gizmo
Effects:
calculates and sets the speed with which this rotates at the next timestep

getBoundingBox

public Vect3Pair getBoundingBox()
Description copied from class: GameObject
Returns the bounding box of this

Overrides:
getBoundingBox in class Gizmo
Returns:
a bounding box generated by merging the bounding boxes of the stationary images of the flipper as it flips

rotateAboutAxis

public void rotateAboutAxis(Vect3 center,
                            Vect3 axis,
                            double angle)
Description copied from class: Gizmo
Rotates this

Overrides:
rotateAboutAxis in class Gizmo

translateBy

public void translateBy(Vect3 v)
Description copied from class: Gizmo
Translates this

Overrides:
translateBy in class Gizmo