Class Actor

java.lang.Object
  |
  +--Actor

public class Actor
extends java.lang.Object

The Actor class is used to get an abstraction of the plain text commands so that the can be used via methods. The methods compose the commands and send them via the communication link.

Version:
1.0
Author:
Gerald Kuehne, Markus Beier

Field Summary
private  Communication communication
           
 
Constructor Summary
Actor(Communication communication)
          Creates a new Actor instance.
 
Method Summary
 void dash(double power)
          Gives a running impulse
 void init(java.lang.String teamName)
          Registers itself to to the server.
 void kick(double power, double direction)
          Kicks into a given direction with given power
 void move(double x, double y)
          Places the player to a given position on the field.
 void turn(double moment)
          Turns the body of the client on the field.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

communication

private Communication communication
Constructor Detail

Actor

public Actor(Communication communication)
Creates a new Actor instance.
Parameters:
communication - a Communication value defining the communication link to the server via which the commands can be sent
See Also:
Communication
Method Detail

init

public void init(java.lang.String teamName)
Registers itself to to the server. Protocol version 7.0 is used by default.
Parameters:
teamName - The name of the team the player should join or create if it does not already exist and there less than two teams already present on the field

dash

public void dash(double power)
Gives a running impulse
Parameters:
power - a double value containing the power of the impulse

kick

public void kick(double power,
                 double direction)
Kicks into a given direction with given power
Parameters:
power - a double value specifying the power of the kick
direction - a double value giving the direction of the kick

move

public void move(double x,
                 double y)
Places the player to a given position on the field. Only possible:
Parameters:
x - gives the position in x direction. The position can vary from -52.5 to 52.5. The unit is meter. Negative values stand for the own half of the field, positive values stand for the opponent's half. The value itself gives the distance from the mid-line.
y - gives the position in y direction. The position can vary from -34.0 to 34.0. The unit is meter. Negative values stand for the left side of the field when looked in direction of the opponent's goal.Positive value stand for the right side. The value itself gives the distance from the line going through the center of both goal and the middle point of the field.

turn

public void turn(double moment)
Turns the body of the client on the field.
Parameters:
moment - is the angle in degree you want to turn. The orientation is clockwise so that positive angles mean right turns. The absolute value of the angel must be smaller than 180 degrees. Otherwise the the server will take the turn as a 180 degree turn. So it should be assured that the angle are normalized before usage