Class AIControlledSpaceship
java.lang.Object
Actor
QuantumObject
Spaceship
AIControlledSpaceship
- Direct Known Subclasses:
- Enemy1, Enemy2, Enemy3
public class AIControlledSpaceship
- extends Spaceship
That would be a spaceship that's flying around on its own, and doesn't need a player to steer it.
|
Field Summary |
protected static double |
initial_speed
The initial speed the spaceship gets assigned on creation. |
protected static double |
speed_deviation
The random deviation that is added to or removed from the inital speed on creation. |
| Fields inherited from class Spaceship |
angled_guns, blink, blink_file, GUN_ANGLE, GUN_DISTANCE, guns, hitpoints, level, max_blink, max_hitpoints, n_guns, N_GUNS, side |
| Methods inherited from class Spaceship |
addGun, addHitpoints, angle, doBlink, fire, getBlinkFile, getHitpoints, getLevel, getMaxBlink, getMaxHitpoints, getNumberOfGuns, getSide, hit, removeGun, removeHitpoints, reorderGuns, setAngledGuns, setBlinkFile, setHitpoints, setLevel, setMaxBlink, setMaxHitpoints, setSide, setupImages |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
initial_speed
protected static double initial_speed
- The initial speed the spaceship gets assigned on creation.
speed_deviation
protected static double speed_deviation
- The random deviation that is added to or removed from the inital speed on creation.
AIControlledSpaceship
public AIControlledSpaceship(int the_level)
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 Spaceship
setInitialSpeed
public static void setInitialSpeed(double speed)
getInitialSpeed
public static double getInitialSpeed()
setDeviation
public static void setDeviation(double deviation)
getDeviation
public static double getDeviation()
beforeDestruction
public void beforeDestruction()
- Description copied from class:
Spaceship
- This method is called right before the spaceship is destroyed by (and only by) lack of hitpoints.
Empty here, to be overridden in subclasses that e. g. want to leave power-ups behind.
- Overrides:
beforeDestruction in class Spaceship
hit
public boolean hit(ManuallyControlledSpaceship s)
- Description copied from class:
QuantumObject
- hit. Base method hit(Actor). Uses java.lang.reflect to dynamically find out which hit() method of the quantum object
to invoke based on which actual class "actor" has. Dynamic dispatch comes true!
- Overrides:
hit in class QuantumObject
- Parameters:
s - The object we are interacting with
- Returns:
- boolean. True if this quantum object should survive, false otherwise.