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.


Variable Index

 o centerPos
The position of the center of the rocket
 o intOrientation
in radians: 0=east, pi/2=north note that the parameter given to the constructor uses a different unit.

Constructor Index

 o Rocket(Position, double, int)
Constructs a new rocket with a given starting point, facing angle and target.
 o 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.

Method Index

 o getTarget()
Returns the currently selected target (for auto-aim).
 o move()
moves forward at the speed indicated by the local var.
 o turnTowards(Position)
Turns the rocket towards the given point.

Variables

 o centerPos
 public Position centerPos
The position of the center of the rocket

 o intOrientation
 public double intOrientation
in radians: 0=east, pi/2=north note that the parameter given to the constructor uses a different unit.

Constructors

 o 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).

 o 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.

Methods

 o getTarget
 public int getTarget()
Returns the currently selected target (for auto-aim).

 o move
 public void move()
moves forward at the speed indicated by the local var. 'speed'

 o 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