| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--hockey.api.Player
Every player in your team should extend this class!
    It implements the IPlayer and IPlayerControl
    interfaces to give you full control and information of the player.
    Additionally it has some methods you must define to give information
    about your player, and some convenience methods for easier control.
    
 There are seven abstract methods that must be implemented.
    Most important is the step method that controls your
    player.
    
getName, getNumber, and
    isLeftHanded are used to give the game basic
    information about the player.  The game will only call these once,
    upon startup.
    init is called after your player intelligence has
    been bound to an actual player.  Here you can do initialisations which
    cannot be done in the constructor, such as setAimOnStick.
    faceOff or penaltyShot is called
    to notify you when the game is resumed after having been stopped
    for some reason.  (Note that during penalty shots, only one of
    your players will be active!)
    step is by far the most important method of them
    all! This is where you control your player.
    
IObject, 
IPlayer, 
IPlayerControl| Field Summary | 
| Fields inherited from interface hockey.api.IPlayerControl | 
| ACCELERATION, MAX_SHOT_SPEED, MAX_SPEED, MAX_STICK_ANGLE, MAX_STICK_R, MAX_TURN_SPEED, MIN_STICK_ANGLE, MIN_STICK_R | 
| Constructor Summary | |
| Player() | |
| Method Summary | |
|  void | faceOff()Called before step when there is a face-off. | 
|  boolean | getAimOnStick()Returns whether the stick is used for aiming. | 
|  IGoalKeeper | getGoalKeeper(int index)Gets a goal-keeper from the game. | 
|  int | getHeading()Returns the absolute heading in degrees. | 
|  int | getIndex()Returns this player's index. | 
| abstract  java.lang.String | getName()The name of the player. | 
| abstract  int | getNumber()The number of the player. | 
|  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 | getSpeed()Returns the speed in cm/s. | 
|  IObject | getStick()Returns the current position of the player's stick, as an IObject. | 
|  int | getStickAngle()Returns the stick relative angle relative to the player's heading, in degrees. | 
|  int | getStickR()Returns the stick distace from the player's centre, in cm. | 
|  int | getStickX()Returns the x-coordinate of the player's stick, in cm. | 
|  int | getStickY()Returns the y-coordinate of the player's stick, in cm. | 
|  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. | 
|  int | getX()Returns the x-coordinate in cm. | 
|  int | getY()Returns the y-coordinate in cm. | 
|  boolean | hasPuck()Returns whether this player has the puck. | 
|  void | init()Initialise the player. | 
| abstract  boolean | isLeftHanded()Whether the player is left-handed. | 
|  boolean | isOpponent()Returns whether this player is your opponent in the game. | 
|  void | moveStick(int dir,
          int dist)Move the stick to a given angle and distance relative to the player. | 
|  void | penaltyShot()Called before step when the player is about to take a penalty-shot. | 
|  void | setAimOnStick(boolean aos)Sets whether the stick or the body position should be used for controls. | 
|  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 | setPlayerControl(IPlayer impl,
                 IPlayerControl ctrl)This method is used internally to receive the IPlayerandIPlayerControlassociated with this player. | 
|  void | shoot(int heading,
      int speed)Shoot the puck in a given absolute heading and speed. | 
|  void | shoot(int x,
      int y,
      int speed)Shoot the puck towards a given position with a given speed. | 
|  void | shoot(IObject o,
      int speed)Shoot the puck towards a given IObjectwith a given
        speed. | 
|  void | showDebugPoint(boolean show)Sets whether the debug point should be shown. | 
|  void | skate(int speed)Accelerate to a given speed. | 
|  void | skate(int x,
      int y,
      int speed)Accelerate to a given speed and turn towards a given position with maximum turn speed. | 
|  void | skate(IObject o,
      int speed)Accelerate to a given speed and turn towards a given IObjectwith maximum turn speed. | 
| abstract  void | step()Called every time step. | 
|  void | turn(int dir,
     int turnSpeed)Turn towards a given angle with a given turn speed. | 
|  void | turn(int x,
     int y,
     int turnSpeed)Turn towards a given position with a given turn speed. | 
|  void | turn(IObject o,
     int turnSpeed)Turn towards a given IObjectwith a given turn speed. | 
| Methods inherited from class java.lang.Object | 
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public Player()
| Method Detail | 
public final void setPlayerControl(IPlayer impl,
                                   IPlayerControl ctrl)
IPlayer
        and IPlayerControl associated with this player.
impl - the player's IPlayer.ctrl - the player's IPlayerControl.public abstract int getNumber()
public abstract java.lang.String getName()
public abstract boolean isLeftHanded()
isLeftHanded in interface IPlayerpublic void init()
public void faceOff()
public void penaltyShot()
public abstract void step()
                   throws java.lang.Exception
java.lang.Exceptionpublic int getX()
IObject
getX in interface IObjectpublic int getY()
IObject
getY in interface IObjectpublic int getHeading()
IObject
getHeading in interface IObjectpublic int getSpeed()
IObject
getSpeed in interface IObjectpublic int getStickAngle()
IPlayer
getStickAngle in interface IPlayerpublic int getStickR()
IPlayer
getStickR in interface IPlayerpublic int getStickX()
IPlayer
getStickX in interface IPlayerpublic int getStickY()
IPlayer
getStickY in interface IPlayerpublic IObject getStick()
IPlayerIObject.
getStick in interface IPlayerpublic boolean isOpponent()
IPlayer
isOpponent in interface IPlayerpublic boolean hasPuck()
IPlayer
hasPuck in interface IPlayerpublic int getIndex()
IPlayer
getIndex in interface IPlayerpublic boolean getAimOnStick()
IPlayerControl
getAimOnStick in interface IPlayerControlpublic int getTargetSpeed()
IPlayerControl
getTargetSpeed in interface IPlayerControlpublic int getTargetHeading()
IPlayerControl
getTargetHeading in interface IPlayerControlpublic int getTurnSpeed()
IPlayerControl
getTurnSpeed in interface IPlayerControlpublic int getTargetStickAngle()
IPlayerControl
getTargetStickAngle in interface IPlayerControlpublic int getTargetStickR()
IPlayerControl
getTargetStickR in interface IPlayerControlpublic void setAimOnStick(boolean aos)
IPlayerControl
setAimOnStick in interface IPlayerControlpublic void skate(int speed)
IPlayerControl
skate in interface IPlayerControl
public void skate(int x,
                  int y,
                  int speed)
public void skate(IObject o,
                  int speed)
IObject with maximum turn speed.
public void turn(int dir,
                 int turnSpeed)
IPlayerControl
turn in interface IPlayerControl
public void turn(int x,
                 int y,
                 int turnSpeed)
public void turn(IObject o,
                 int turnSpeed)
IObject with a given turn speed.
public void moveStick(int dir,
                      int dist)
IPlayerControl
moveStick in interface IPlayerControl
public void shoot(int heading,
                  int speed)
IPlayerControl
shoot in interface IPlayerControl
public void shoot(int x,
                  int y,
                  int speed)
public void shoot(IObject o,
                  int speed)
IObject with a given
        speed.
public int getScore(boolean myScore)
IPlayerControl
getScore in interface IPlayerControlmyScore - whether you want your own score or your
 opponent's score.public IPuck getPuck()
IPlayerControl
getPuck in interface IPlayerControlpublic IGoalKeeper getGoalKeeper(int index)
IPlayerControl
getGoalKeeper in interface IPlayerControlindex - the index of the goal-keeper:
        public IPlayer getPlayer(int index)
IPlayerControl
getPlayer in interface IPlayerControlindex - the index of the player. The indices are:
        public void setMessage(java.lang.String message)
IPlayerControlSystem.out.
setMessage in interface IPlayerControlmessage - the message.
public void setDebugPoint(int x,
                          int y,
                          java.awt.Color c)
IPlayerControl
setDebugPoint in interface IPlayerControlpublic void showDebugPoint(boolean show)
IPlayerControl
showDebugPoint in interface IPlayerControl| 
 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||