gizmoball.gameworld.gameobjects
Class ShipGizmo

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

public class ShipGizmo
extends Gizmo

A ShipGizmo represents the player's ship in Multiplayer Space Invaders.

Specification Fields

Field Summary
 
Fields inherited from class gizmoball.gameworld.Gizmo
orientation, totalTranslation
 
Constructor Summary
ShipGizmo(Vect3 tip, double depth, Vect3 away, double length, double shootSpeed, GameWorldState ws, double maximumMovement, double rateOfFire, java.util.List<Gizmo> draggedGizmos)
          Creates a ship, in the form of an arrow.
 
Method Summary
 void addDraggedGizmo(Gizmo g)
           
 void doActivate()
          Immediately "activates" this gizmo.
protected  void doUpdate(double dt)
          The same as GameObject.update().
 GraphicsProperties getGraphicsProperties()
          Returns an object that holds the information necessary for drawing this object.
 java.util.List<Gun> getGuns()
          Gets the list of guns that are on this ship.
 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 increaseRateOfFire(double multiplier)
           
 void moveLeft()
           
 Trigger moveLeftTrigger()
           
 void moveRight()
           
 Trigger moveRightTrigger()
           
 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

ShipGizmo

public ShipGizmo(Vect3 tip,
                 double depth,
                 Vect3 away,
                 double length,
                 double shootSpeed,
                 GameWorldState ws,
                 double maximumMovement,
                 double rateOfFire,
                 java.util.List<Gizmo> draggedGizmos)
Creates a ship, in the form of an arrow. The tip is at "tip", going in direction "away", with length "length", with constrant cross-sections in the xy plane.

Parameters:
tip - the location of the tip of the ship
depth - the depth of the ship
away - the vector from tip to the center of the ship
length - the length of the ship
shootSpeed - the velocity of shots fired
ws - the world state that the shots will be added to. must contain at least one player, and the first player has a score and lives counter.
maximumMovement - the maximum linear distance that you can move to either side
rateOfFire - the number of seconds between each shot
draggedGizmos - the gizmos carried by the ship
Method Detail

addDraggedGizmo

public void addDraggedGizmo(Gizmo g)
Effects:
adds g to draggedGizmos

getGuns

public java.util.List<Gun> getGuns()
Gets the list of guns that are on this ship. You can make changes to this list and they will be reflected.


increaseRateOfFire

public void increaseRateOfFire(double multiplier)
Effects:
increases the rate of fire to be multiplied by the given factor (ie if the factor is >1, it gets faster)

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:
attempts to shoot for the delay in user actions

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 appropriate movement; attempts to shoot if possible

moveRightTrigger

public Trigger moveRightTrigger()
Returns:
a Trigger that moves this right

moveLeftTrigger

public Trigger moveLeftTrigger()
Returns:
a Trigger that moves this left

moveRight

public void moveRight()
Effects:
moves this right

moveLeft

public void moveLeft()
Effects:
moves this left

rotateAboutAxis

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

Overrides:
rotateAboutAxis in class Gizmo

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

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.

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