|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectGun
public class Gun
Gun: shoots (i. e. emits) missiles (like a Factory). Handles shooting timeouts. Can be put into a spaceship.
| Field Summary | |
|---|---|
protected double |
abs_speed
Absolute value of the speed vector that's set to missiles. |
protected double |
angle
Angle the missiles are launched with (to y axis, value in radians). |
protected int |
direction
Direction the gun is facing. |
protected int |
dx
X distance of launched bullets from spaceship center. |
protected int |
dy
|
static int |
initial_recovery
Initial recovery time of this kind of gun. |
protected int |
level
Level of the gun (and thus of the missiles). |
protected int |
recovery
The number to which timer is set after a bullet has been launched. |
protected int |
side
Side the gun (and so the missiles) is on. |
protected Vector |
speed
Speed the missiles are set to when launched. |
protected int |
timer
This variable determines how many turns the gun has to wait before it may emit another bullet. |
| Constructor Summary | |
|---|---|
Gun()
|
|
Gun(double the_abs_speed,
double the_angle)
|
|
Gun(Vector the_speed)
|
|
| Method Summary | |
|---|---|
Gun |
copy_gun()
Return an exact copy of this gun. |
int |
get_dx()
|
int |
get_dy()
|
protected Missile |
get_missile()
|
double |
getAbsSpeed()
|
double |
getAngle()
|
static int |
getInitialRecovery()
|
int |
getLevel()
|
int |
getRecovery()
|
int |
getSide()
|
int |
getTimer()
|
protected void |
init()
|
Missile |
missile()
Emit a new bullet or null if not ready yet. |
void |
set_dx(int new_dx)
|
void |
set_dy(int new_dy)
|
static void |
setInitialRecovery(int the_recovery)
|
void |
setLevel(int the_level)
|
void |
setRecovery(int the_recovery)
|
void |
setSide(int new_side)
|
void |
setSpeed(double the_abs_speed,
double the_angle)
|
void |
setSpeed(Vector the_speed)
|
void |
setTimer(int timer_value)
|
void |
tick()
Send a tick to the gun every time act() is called in the containing spaceship. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int timer
missile()protected int recovery
protected Vector speed
protected int side
protected int level
protected int dx
protected int dy
dxprotected double abs_speed
protected double angle
protected int direction
dypublic static int initial_recovery
| Constructor Detail |
|---|
public Gun(double the_abs_speed,
double the_angle)
public Gun(Vector the_speed)
public Gun()
| Method Detail |
|---|
public Gun copy_gun()
MoreGunsprotected void init()
public void setSpeed(Vector the_speed)
public void setSpeed(double the_abs_speed,
double the_angle)
public void tick()
protected Missile get_missile()
public Missile missile()
public int get_dx()
public int get_dy()
public void set_dx(int new_dx)
public void set_dy(int new_dy)
public int getSide()
public void setSide(int new_side)
public int getTimer()
public void setTimer(int timer_value)
public int getLevel()
public void setLevel(int the_level)
public int getRecovery()
public void setRecovery(int the_recovery)
public double getAbsSpeed()
public double getAngle()
public static int getInitialRecovery()
public static void setInitialRecovery(int the_recovery)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||