hockey.api
Interface IPlayerControl

All Known Subinterfaces:
IGoalKeeperControl
All Known Implementing Classes:
GoalKeeper, Player

public interface IPlayerControl

An interface to player control.

Also provides information about the player that is not available to other players, and game queries to retreive the puck, goal-keepers and other players.


Field Summary
static int ACCELERATION
          Player acceleration, in cm/s^2
static int MAX_SHOT_SPEED
          Maximum absolute shot speed, in cm/s
static int MAX_SPEED
          Maximum player speed, in cm/s
static int MAX_STICK_ANGLE
          Maximum stick relative angle from player's heading, in degrees.
static int MAX_STICK_R
          Maximum stick distance from player's centre, in cm.
static int MAX_TURN_SPEED
          Maximum turn speed, in degrees/s
static int MIN_STICK_ANGLE
          Minimum stick relative angle from player's heading, in degrees.
static int MIN_STICK_R
          Minimum stick distance from player's centre, in cm.
 
Method Summary
 boolean getAimOnStick()
          The aimOnStick property controls whether the endpoint of the stick or the body position should used when moving to a target position.
 IGoalKeeper getGoalKeeper(int index)
          Gets a goal-keeper from the game.
 IPlayer getPlayer(int index)
          Gets a player from the game.
 IPuck getPuck()
          Gets the puck from the game.
 int getScore(boolean myScore)
          Gets the current score of one of the teams.
 int getTargetHeading()
          Returns the target heading, in degrees.
 int getTargetSpeed()
          Returns the target speed, in cm/s.
 int getTargetStickAngle()
          Returns the target stick relative angle from player's heading, in degrees.
 int getTargetStickR()
          Returns the target stick distance from player's centre, in degrees.
 int getTurnSpeed()
          Returns the turn speed, in degrees/s.
 void moveStick(int angle, int radius)
          Move the stick to a given angle and distance relative to the player.
 void setAimOnStick(boolean aos)
          The aimOnStick property controls whether the endpoint of the stick or the body position should used when moving to a target position.
 void setDebugPoint(int x, int y, java.awt.Color c)
          Sets a point displayed in the HDE.
 void setMessage(java.lang.String message)
          Sets the message displayed in the HDE.
 void shoot(int heading, int speed)
          Shoot the puck in a given absolute heading and speed.
 void showDebugPoint(boolean show)
          Sets whether the debug point should be shown.
 void skate(int speed)
          Accelerate to a given speed.
 void turn(int heading, int turnSpeed)
          Turn towards a given angle with a given turn speed.
 

Field Detail

ACCELERATION

public static final int ACCELERATION
Player acceleration, in cm/s^2

See Also:
Constant Field Values

MAX_SPEED

public static final int MAX_SPEED
Maximum player speed, in cm/s

See Also:
Constant Field Values

MAX_TURN_SPEED

public static final int MAX_TURN_SPEED
Maximum turn speed, in degrees/s

See Also:
Constant Field Values

MIN_STICK_R

public static final int MIN_STICK_R
Minimum stick distance from player's centre, in cm.

See Also:
Constant Field Values

MAX_STICK_R

public static final int MAX_STICK_R
Maximum stick distance from player's centre, in cm.

See Also:
Constant Field Values

MIN_STICK_ANGLE

public static final int MIN_STICK_ANGLE
Minimum stick relative angle from player's heading, in degrees.

See Also:
Constant Field Values

MAX_STICK_ANGLE

public static final int MAX_STICK_ANGLE
Maximum stick relative angle from player's heading, in degrees.

See Also:
Constant Field Values

MAX_SHOT_SPEED

public static final int MAX_SHOT_SPEED
Maximum absolute shot speed, in cm/s

See Also:
Constant Field Values
Method Detail

getAimOnStick

public boolean getAimOnStick()
The aimOnStick property controls whether the endpoint of the stick or the body position should used when moving to a target position.


getTargetSpeed

public int getTargetSpeed()
Returns the target speed, in cm/s.


getTargetHeading

public int getTargetHeading()
Returns the target heading, in degrees.


getTurnSpeed

public int getTurnSpeed()
Returns the turn speed, in degrees/s.


getTargetStickAngle

public int getTargetStickAngle()
Returns the target stick relative angle from player's heading, in degrees.


getTargetStickR

public int getTargetStickR()
Returns the target stick distance from player's centre, in degrees.


setAimOnStick

public void setAimOnStick(boolean aos)
The aimOnStick property controls whether the endpoint of the stick or the body position should used when moving to a target position.


skate

public void skate(int speed)
Accelerate to a given speed.


turn

public void turn(int heading,
                 int turnSpeed)
Turn towards a given angle with a given turn speed.


moveStick

public void moveStick(int angle,
                      int radius)
Move the stick to a given angle and distance relative to the player.


shoot

public void shoot(int heading,
                  int speed)
Shoot the puck in a given absolute heading and speed.


getScore

public int getScore(boolean myScore)
Gets the current score of one of the teams.

Parameters:
myScore - whether you want your own score or your opponent's score.

getPuck

public IPuck getPuck()
Gets the puck from the game.


getGoalKeeper

public IGoalKeeper getGoalKeeper(int index)
Gets a goal-keeper from the game.

Parameters:
index - the index of the goal-keeper:
  • 0 - Your own goal-keeper.
  • 6 - Your opponent's goal-keeper.

getPlayer

public IPlayer getPlayer(int index)
Gets a player from the game.

Parameters:
index - the index of the player. The indices are:
  • Your own
    • 0 - goal-keeper.
    • 1 - left defender.
    • 2 - right defender.
    • 3 - left forward.
    • 4 - right forward.
    • 5 - centre forward.
  • Your opponent's
    • 6 - goal-keeper.
    • 7 - left defender.
    • 8 - right defender.
    • 9 - left forward.
    • 10 - right forward.
    • 11 - centre forward.

setMessage

public void setMessage(java.lang.String message)
Sets the message displayed in the HDE. You should use this function instead of writing to System.out.

Parameters:
message - the message.

setDebugPoint

public void setDebugPoint(int x,
                          int y,
                          java.awt.Color c)
Sets a point displayed in the HDE. This is very useful for debugging.


showDebugPoint

public void showDebugPoint(boolean show)
Sets whether the debug point should be shown.