|
|||||||||
PREV NEXT | FRAMES NO FRAMES |
Uses of Direction in gameLogic |
---|
Methods in gameLogic that return Direction | |
---|---|
Direction |
Snake.getCurrentDirection()
Gets the direction this snake moved in last turn. |
Direction |
Snake.getDirection(Position position)
Get the direction of a specific segment in this snake. |
static Direction |
Direction.getDirectionFromPositionToPosition(Position from,
Position to)
Returns the direction between two positions, as long as they are on a straight line. |
Direction |
Brain.getNextMove(Snake yourSnake,
GameState gameState)
Returns which direction this brain wishes its snake to move in. |
Direction |
Direction.turnLeft()
Returns a new direction that would be the same as turning left. |
Direction |
Direction.turnRight()
Returns a new direction that would be the same as turning right. |
static Direction |
Direction.valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static Direction[] |
Direction.values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods in gameLogic that return types with arguments of type Direction | |
---|---|
static java.util.ArrayList<Direction> |
GameState.getRelativeDirections(Position from,
Position to)
Returns in which direction one has to move in order to reach one position from another one. |
Methods in gameLogic with parameters of type Direction | |
---|---|
static Position |
GameState.calculateNextPosition(Direction direction,
Position oldPosition)
Gets the next position a snake would end up in if it continues in this direction. |
boolean |
GameState.willCollide(Snake snake,
Direction dir)
This method can be used to help calculate whether or not a given snake will collide next turn if it continues in a given direction. |
|
|||||||||
PREV NEXT | FRAMES NO FRAMES |