Class Missile

java.lang.Object
  extended by Actor
      extended by QuantumObject
          extended by Missile
Direct Known Subclasses:
BulletBill, Laser

public class Missile
extends QuantumObject

Base class for projectiles and other kinds of things one can shoot on his enemies.


Field Summary
protected  int damage
           
protected  int side
           
 
Fields inherited from class QuantumObject
destroysOnNextTurn, disappear, mantissa, speed
 
Constructor Summary
Missile()
           
 
Method Summary
 void act()
          A day in the life of a quantum object: 1.
 int getDamage()
           
 int getSide()
           
 boolean hit(Spaceship s)
          Dummy hit function that allows for dummy missiles.
 void setDamage(int the_damage)
           
 void setSide(int gun_side)
           
 
Methods inherited from class QuantumObject
getDestroysOnNextTurn, getSpeed, move, setDestroysOnNextTurn, setSpeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

side

protected int side

damage

protected int damage
Constructor Detail

Missile

public Missile()
Method Detail

act

public void act()
Description copied from class: QuantumObject
A day in the life of a quantum object: 1. Maybe commit suicide (i. e. destroys itself when destroysOnNextTurn is true) 2. Do quantum object interactions with intersecting objects 3. -- Err... are you missing point 3?

Overrides:
act in class QuantumObject

setSide

public void setSide(int gun_side)

getSide

public int getSide()

setDamage

public void setDamage(int the_damage)

getDamage

public int getDamage()

hit

public boolean hit(Spaceship s)
Dummy hit function that allows for dummy missiles. Upon hitting a spaceship from the other side, the missile is destroyed. The missile itself doesn't subtract hit points from the spaceship, it's Spaceship.hit(Missile) doing that. This way of coding doesn't allow for flawfully programmed Spaceship subclasses, but it's more flexible.

Overrides:
hit in class QuantumObject
Parameters:
s - The object we are interacting with
Returns:
boolean. True if this quantum object should survive, false otherwise.
See Also:
Spaceship.hit(Missile)