gizmoball.gameworld.gameobjects
Class EnemyShip

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

public class EnemyShip
extends Gizmo

An EnemyShip represents a ship with a constant velocity that shoots automatically in Multiplayer Space Invaders.

Specification Fields

Field Summary
 
Fields inherited from class gizmoball.gameworld.Gizmo
orientation, totalTranslation
 
Constructor Summary
EnemyShip(Vect3 tip, double depth, Vect3 away, double length, double shootSpeed, GameWorldState ws, double shootChance)
          Creates a new EnemyShip
EnemyShip(Vect3 tip, double depth, Vect3 away, double length, double shootSpeed, GameWorldState ws, double shootChance, Gun gun)
          Creates a new EnemyShip
 
Method Summary
 void doActivate()
          An EnemyShip does nothing when activated
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
 int numPoints()
          returns the number of points that killing this ship is worth
 
Methods inherited from class gizmoball.gameworld.Gizmo
activate, copy, getBoundingBox, getCoeffReflectionString, getColorString, getCommonAttributesString, getDefaultTriggers, getOrientationDoubleString, getOrientationString, getReflectionCoeff, getTextureString, getTranslationString, getXMLDelay, getXMLDelayString, rotateAboutAxis, 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

EnemyShip

public EnemyShip(Vect3 tip,
                 double depth,
                 Vect3 away,
                 double length,
                 double shootSpeed,
                 GameWorldState ws,
                 double shootChance,
                 Gun gun)
Creates a new EnemyShip

Parameters:
tip - the coordinates of the point of the ship
depth - the depth of the ship
away - the direction vector from tip to the center of the ship
length - the length of the ship
shootSpeed - how fast the ship's bullets are
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.
shootChance - is probability that it will shoot, approximately #shots/second

EnemyShip

public EnemyShip(Vect3 tip,
                 double depth,
                 Vect3 away,
                 double length,
                 double shootSpeed,
                 GameWorldState ws,
                 double shootChance)
Creates a new EnemyShip

Parameters:
tip - the coordinates of the point of the ship
depth - the depth of the ship
away - the direction vector from tip to the center of the ship
length - the length of the ship
shootSpeed - how fast the ship's bullets are
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.
shootChance - is probability that it will shoot, approximately #shots/second
Method Detail

doActivate

public void doActivate()
An EnemyShip does nothing when activated

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:
shoots out an EnemyShot with probability this.shootChance removes this if it is below the bottom of the screen

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

numPoints

public int numPoints()
returns the number of points that killing this ship is worth