Class MoreGuns

java.lang.Object
  extended by Actor
      extended by QuantumObject
          extended by Collectible
              extended by MoreGuns

public class MoreGuns
extends Collectible

Add one gun to a spaceship.


Field Summary
 
Fields inherited from class QuantumObject
destroysOnNextTurn, disappear, mantissa, speed
 
Constructor Summary
MoreGuns()
           
 
Method Summary
 void act()
          A day in the life of a quantum object: 1.
 boolean hit(ManuallyControlledSpaceship ship)
          Dummy hit method.
 void setNumberOfGuns(ManuallyControlledSpaceship ship, int new_n_guns)
          Set the number of guns for a spaceship.
 
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
 

Constructor Detail

MoreGuns

public MoreGuns()
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 Collectible

hit

public boolean hit(ManuallyControlledSpaceship ship)
Description copied from class: Collectible
Dummy hit method. Only triggers when hitting a ManuallyControlledShip. The powerup is destroyed then (after actions have been performed on the ship). A good indicator of programming mistakes inside a Collectible subclass: the collectible doesn't disappear upon touching a ManuallyControlledShip.

Overrides:
hit in class Collectible
Parameters:
ship - The object we are interacting with
Returns:
boolean. True if this quantum object should survive, false otherwise.

setNumberOfGuns

public void setNumberOfGuns(ManuallyControlledSpaceship ship,
                            int new_n_guns)
Set the number of guns for a spaceship. If new_n_guns is greater than the current number of guns, copy the ship's first gun and add the copies.

Parameters:
ship - guess what
new_n_guns - number of guns to set