Locatable
public interface Player extends Locatable
Controller
.
In terms of collisions, players can be thought of as cylinders on the field.
The bottom plane is at a height of zero, corresponding with the ground plane
of the field. The top plane is at a height of getHeight()
, which is
the top of the player's head. The radius of the cylinder (for all players) is
COLLISION_RADIUS
. The central axis of the cylinder can be located
with Locatable.getLocation()
, relative to the bottom-left corner of the field
when viewed from above.
Controller
,
PlayerUtils
,
Team
Modifier and Type | Interface | Description |
---|---|---|
static class |
Player.Hand |
A player's hand, either left or right.
|
Modifier and Type | Field | Description |
---|---|---|
static RandomScalar |
COLLISION_DAMAGE |
The amount of damage done by player-player collisions.
|
static double |
COLLISION_RADIUS |
The radius for a player's collisions with other field objects.
|
static RandomScalar |
DUCK_SPEED |
The per-turn decrease in height of a ducking player.
|
static double |
ENERGY_DECREMENT |
The small amount of energy that is decremented from active players.
|
static RandomScalar |
FORWARD_MOVEMENT_SPEED |
The distance a player can move forward on a turn.
|
static double |
HEIGHT |
The normal (non-ducking) height of every player.
|
static double |
LEFT_ARM_DIRECTION |
The direction of a player's left arm relative to their heading.
|
static double |
MAX_ENERGY |
The maximum amount of energy that a player can have.
|
static double |
MIN_HEIGHT |
The minimum (ducking) height of every player.
|
static double |
REACH_DISTANCE |
The maximum distance for a piece of food that can be picked up.
|
static double |
REACH_RANGE |
The rotational range for a piece of food that can be picked up.
|
static RandomScalar |
REVERSE_MOVEMENT_SPEED |
The distance a player can move backward on a turn.
|
static double |
RIGHT_ARM_DIRECTION |
The direction of a player's right arm relative to their heading.
|
static RandomScalar |
THROW_HEIGHT |
The height at which thrown food starts.
|
static RandomScalar |
TURN_SPEED |
The per-turn change in rotation (in radians) of a turning player.
|
Modifier and Type | Method | Description |
---|---|---|
double |
getEnergy() |
Gets this player's amount of energy.
|
Direction |
getHeading() |
Gets the direction that this player is currently facing.
|
double |
getHeight() |
Gets the height of the top of this player's head.
|
Inventory |
getInventory() |
Gets this player's inventory.
|
char |
getSymbol() |
Gets the character that uniquely identifies this player in the game.
|
getLocation
static final double HEIGHT
static final double MIN_HEIGHT
static final RandomScalar THROW_HEIGHT
static final RandomScalar FORWARD_MOVEMENT_SPEED
static final RandomScalar REVERSE_MOVEMENT_SPEED
static final RandomScalar DUCK_SPEED
static final RandomScalar TURN_SPEED
static final double REACH_DISTANCE
static final double REACH_RANGE
static final double LEFT_ARM_DIRECTION
static final double RIGHT_ARM_DIRECTION
static final double COLLISION_RADIUS
static final double MAX_ENERGY
static final double ENERGY_DECREMENT
static final RandomScalar COLLISION_DAMAGE
char getSymbol()
double getHeight()
MIN_HEIGHT
and HEIGHT
. The only
way for this value to decrease is for a player to duck (if the player's
controller returns an action of Controller.Action.DUCK
). If a piece of food
has a higher height than a given player, it will not collide with that
player.Direction getHeading()
Controller.Action.TURN_LEFT
or
Controller.Action.TURN_RIGHT
. If a player moves forward, they will move in
the direction of their heading.Inventory getInventory()
double getEnergy()
MAX_ENERGY
, inclusive. A player's energy affects how
quickly they are able to move. Each turn, a small amount of energy
(ENERGY_DECREMENT
) is subtracted from the energy total of every
player who isn't idling, ducking, or eating, so players who move more
early in the game may move more slowly later in the game. Additionally,
colliding with a piece of food or another player will cost a player
energy. The only way for a player's energy to increase is if they eat a
piece of food.