All Packages Class Hierarchy This Package Previous Next Index
Class ch.jp.robwar.Rocket
java.lang.Object
|
+----ch.jp.robwar.MapObject
|
+----ch.jp.robwar.LinearMapObject
|
+----ch.jp.robwar.Rocket
- public class Rocket
- extends LinearMapObject
- implements Serializable
Describes a rocket.
---- all the rest here is wrong ---
bullet. Bullets stop when they hit a robot or
a wall. Hitting another bullet, weapon or explosion doesn't
affect them.
The relevant fields are position (the bullet's current position)
and dPos, the bullet's speed vector.
-
centerPos
- The position of the center of the rocket
-
intOrientation
- in radians: 0=east, pi/2=north
note that the parameter given to the constructor uses a different
unit.
-
Rocket(Position, double, int)
- Constructs a new rocket with a given starting point, facing
angle and target.
-
Rocket(Position, Position)
- This form of the constructor should not be used to instanciate
a Rocket object: I prefer getting the position and angle and
computing the two endpoints myself.
-
getTarget()
- Returns the currently selected target (for auto-aim).
-
move()
- moves forward at the speed indicated by the local var.
-
turnTowards(Position)
- Turns the rocket towards the given point.
centerPos
public Position centerPos
- The position of the center of the rocket
intOrientation
public double intOrientation
- in radians: 0=east, pi/2=north
note that the parameter given to the constructor uses a different
unit.
Rocket
public Rocket(Position nPos,
double angle,
int nTarget)
- Constructs a new rocket with a given starting point, facing
angle and target. Angle is in *degrees*, 0=east, 90=north.
It should be in [0..360[.
LinearMapObjects have two extremities, 'from' and 'to'.
In a rocket, the 'to' end points forward (in the direction
of the rocket).
Rocket
public Rocket(Position a,
Position b)
- This form of the constructor should not be used to instanciate
a Rocket object: I prefer getting the position and angle and
computing the two endpoints myself.
Therefore, use of this constructor results in an exception:
the other form of the constructor should be used instead.
getTarget
public int getTarget()
- Returns the currently selected target (for auto-aim).
move
public void move()
- moves forward at the speed indicated by the local var. 'speed'
turnTowards
public void turnTowards(Position target)
- Turns the rocket towards the given point. The turning
abilities are limited to maxTurn radians per call to turnTowards.
All Packages Class Hierarchy This Package Previous Next Index