|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectActor
QuantumObject
Spaceship
public class Spaceship
Stuff that flies through the sky. Base class for both AI-controlled ships and manually controlled ones.
| Field Summary | |
|---|---|
protected boolean |
angled_guns
Determines if guns should shoot in a straight way (angled_guns = false) or rather in a widespread way (angled_guns = true). |
protected int |
blink
Variable containing the state of the blink animation that happens when the spaceship is damaged. |
protected java.lang.String |
blink_file
Filename of the sprite to be used while blinking, i. |
static double |
GUN_ANGLE
Determines the angular distance between guns when angled_guns is true. |
static int |
GUN_DISTANCE
X distance between guns on one spaceship. |
protected Gun[] |
guns
|
protected int |
hitpoints
|
protected int |
level
|
protected int |
max_blink
How many turns the blinking animations should last. |
protected int |
max_hitpoints
|
protected int |
n_guns
|
static int |
N_GUNS
|
protected int |
side
|
| Fields inherited from class QuantumObject |
|---|
destroysOnNextTurn, disappear, mantissa, speed |
| Constructor Summary | |
|---|---|
Spaceship(int the_level)
|
|
| Method Summary | |
|---|---|
void |
act()
A day in the life of a quantum object: 1. |
void |
addGun(int position,
Gun new_gun)
Add a gun in the given position. |
void |
addHitpoints(int n_hitpoints)
|
double |
angle(double x,
double max_angle)
Return an angle that lies between -max_angle and max_angle for x between 0 and 1 |
void |
beforeDestruction()
This method is called right before the spaceship is destroyed by (and only by) lack of hitpoints. |
void |
doBlink()
Do the blinking animation. |
protected void |
fire()
Try to fire (all) the guns. |
java.lang.String |
getBlinkFile()
|
int |
getHitpoints()
|
int |
getLevel()
|
int |
getMaxBlink()
|
int |
getMaxHitpoints()
|
int |
getNumberOfGuns()
|
int |
getSide()
|
boolean |
hit(Missile m)
If the missile was shot by an enemy, subtract hitpoints. |
void |
removeGun(int position)
Remove the gun in the given position. |
void |
removeHitpoints(int n_hitpoints)
|
void |
reorderGuns()
Set the guns' dx values so that the missiles are launched from appear in an neat, aligned fashion. |
void |
setAngledGuns(boolean angled)
Sets the ship to shoot straight or widespread (aka angled). |
void |
setBlinkFile(java.lang.String the_blink_file)
|
void |
setHitpoints(int hit)
|
void |
setLevel(int new_level)
|
void |
setMaxBlink(int max)
|
void |
setMaxHitpoints(int max)
|
void |
setSide(int new_side)
|
protected void |
setupImages()
Sort-of abstract method available for overriddance [sic]. |
| 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 |
|---|
protected int side
protected int level
protected int hitpoints
protected int max_hitpoints
protected int blink
doBlink()protected int max_blink
protected java.lang.String blink_file
public static final int GUN_DISTANCE
public static final double GUN_ANGLE
angled_guns,
n_guns,
Constant Field Valuespublic static final int N_GUNS
protected Gun[] guns
protected int n_guns
protected boolean angled_guns
| Constructor Detail |
|---|
public Spaceship(int the_level)
| Method Detail |
|---|
public void act()
QuantumObject
act in class QuantumObject
public void addGun(int position,
Gun new_gun)
MoreGunspublic void removeGun(int position)
addGun(int position, Gun new_gun)public int getNumberOfGuns()
public void reorderGuns()
public double angle(double x,
double max_angle)
x - number between 0.0 and 1.0public void setAngledGuns(boolean angled)
public void setSide(int new_side)
public int getSide()
public void setLevel(int new_level)
public int getLevel()
protected void fire()
public void addHitpoints(int n_hitpoints)
public void removeHitpoints(int n_hitpoints)
public int getHitpoints()
public void setHitpoints(int hit)
public int getMaxHitpoints()
public void setMaxHitpoints(int max)
public void beforeDestruction()
public boolean hit(Missile m)
hit in class QuantumObjectm - The object we are interacting with
protected void setupImages()
doBlink()public void setBlinkFile(java.lang.String the_blink_file)
public java.lang.String getBlinkFile()
public void doBlink()
public void setMaxBlink(int max)
public int getMaxBlink()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||