gizmoball.gameworld.gameobjects
Class Paddle

java.lang.Object
  extended by gizmoball.gameworld.GameObject
      extended by gizmoball.gameworld.Gizmo
          extended by gizmoball.gameworld.gameobjects.Paddle
Direct Known Subclasses:
JumpingPaddle

public class Paddle
extends Gizmo

A Paddle is a slice of a circular prism that is moved in one linear dimension.

Specification Fields :
linearSpeed : double // speed in L/sec

Field Summary
 
Fields inherited from class gizmoball.gameworld.Gizmo
orientation, totalTranslation
 
Constructor Summary
Paddle(Vect3 center, Vect3 up, double width, double angle, int numDivisions, double depth, double linearSpeed, double maxDistance)
          Creates a new paddle, that looks roughly like a slice of a circle.
 
Method Summary
 void doActivate()
          A Paddle does nothing upon activation.
protected  void doUpdate(double dt)
          The same as GameObject.update().
 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 moveLeft()
           
 Trigger moveLeftTrigger()
           
 void moveRight()
           
 Trigger moveRightTrigger()
           
 void resetMovementAmount()
          The paddle keeps track of how far it has moved, with respect to how far it can move.
 void rotateAboutAxis(Vect3 center, Vect3 axis, double angle)
          Rotates this
 
Methods inherited from class gizmoball.gameworld.Gizmo
activate, copy, getBoundingBox, getCoeffReflectionString, getColorString, getCommonAttributesString, getDefaultTriggers, getOrientationDoubleString, getOrientationString, getReflectionCoeff, getTextureString, getTranslationString, getXMLDelay, getXMLDelayString, setCoefficientOfReflection, setCommonAttributes, setDelay, translateBy, 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

Paddle

public Paddle(Vect3 center,
              Vect3 up,
              double width,
              double angle,
              int numDivisions,
              double depth,
              double linearSpeed,
              double maxDistance)
Creates a new paddle, that looks roughly like a slice of a circle. It is in the xy plane

Parameters:
center - the midpoint of the chord plane
up - the vector that is normal to the chord, pointing towards the arc
width - the length of the chord
angle - the central angle of the arc (in radians)
numDivisions - the number of divisions to use
linearSpeed - speed in L/sec
Method Detail

doActivate

public void doActivate()
A Paddle does nothing upon activation.

Specified by:
doActivate in class Gizmo

doUpdate

protected 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 necessary velocity to move for the next update

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

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.

moveRight

public void moveRight()
Effects:
tells this to move right for a certain time period

moveLeft

public void moveLeft()
Effects:
tells this to move left for a certain time period

moveRightTrigger

public Trigger moveRightTrigger()
Returns:
a Trigger that tells this to move right

moveLeftTrigger

public Trigger moveLeftTrigger()
Returns:
a Trigger that tells this to move left

rotateAboutAxis

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

Overrides:
rotateAboutAxis in class Gizmo
Effects:
rotates the paddle, changing the movement direction

resetMovementAmount

public void resetMovementAmount()
The paddle keeps track of how far it has moved, with respect to how far it can move. This tells it that you have reset it back to its original position, and to reset its internal counter. Also stops the paddles movement.