Describes the Snake entity of the game.
More...
#include <snake.h>
|
| bool | init (Point begin, short direction, int length) |
| | Initializes snake as an entity without ancoring it anywhere. More...
|
| |
| void | setScheme () |
| |
| void | getCoords (std::list< Point > *currBody) |
| | The method to get the snake whole body coordinates(x ,y) without giving the direct access. More...
|
| |
| Point | getHeadCoords () |
| | The method to get the coordinates(x, y) of the snake's head without giving the direct access. More...
|
| |
| bool | setDirection (int dir) |
| | The method to set the direction where the snake is heading. More...
|
| |
| short | getDirection () |
| | The method to get the current direction without giving the direct access. More...
|
| |
| bool | move (Labyrinth *labyrinth) |
| | The snake movement on the game field(should be called in each iteration of the game cycle, unless the snake is 'dead') More...
|
| |
Describes the Snake entity of the game.
- Parameters
-
| direction | - current direction where the snake is heading |
| style | - array, which describes how should the snake be colored |
| snakeBody | - deque type array, containing positions of snake's body segments |
Definition at line 79 of file snake.h.
Checking the given point for intersections with Ball, borders, obstacles.
- Parameters
-
| check | - a Point to check |
| labyrinth | - 2-dimensional array defying current state of every point of the game field (blocked or not) |
| ball | - a pointer to a Ball object(to check intersection with) |
- Returns
- - type of collision
Definition at line 248 of file snake.cpp.
| short Snake::checkWisely |
( |
Point |
check, |
|
|
Point |
bCoords |
|
) |
| |
|
private |
If the Point of the labyrinth we are checking is not free then decide the type of collision.
- Parameters
-
| check | - Point we are checking for type of a collision |
| bCoords | - Point, containing the coordinates of the Ball |
- Returns
- - type of the collision
Definition at line 264 of file snake.cpp.
| void Snake::getCoords |
( |
std::list< Point > * |
currBody | ) |
|
The method to get the snake whole body coordinates(x ,y) without giving the direct access.
- Parameters
-
| currBody | - an array where the current snake body is copied |
Definition at line 331 of file snake.cpp.
| short Snake::getDirection |
( |
| ) |
|
The method to get the current direction without giving the direct access.
Definition at line 313 of file snake.cpp.
| Point Snake::getHeadCoords |
( |
| ) |
|
The method to get the coordinates(x, y) of the snake's head without giving the direct access.
Definition at line 321 of file snake.cpp.
| bool Snake::init |
( |
Point |
begin, |
|
|
short |
dir, |
|
|
int |
length |
|
) |
| |
Initializes snake as an entity without ancoring it anywhere.
- Parameters
-
| begin | - starting Point of a snake(where the tail segment will be situated) |
| dir | - direction of snake's 'growth' as well as it's starting direction |
| length | - the length of a 'new born' snake |
- Returns
- - mark of whether the snake is successfully initialized
Definition at line 20 of file snake.cpp.
The snake movement on the game field(should be called in each iteration of the game cycle, unless the snake is 'dead')
- Parameters
-
| labyrinth | - the current state of the labyrinth object for intersection checking |
| ball | - a pointer to a Ball object(to check intersection with) |
| change | - 2-dimensional array of changes needed to be applied to the labyrinth |
| changeSize | - max(len(change[0]), len(change[1]))) |
- Returns
- - mark of whether there was a non-boundary non-ball collision
Definition at line 80 of file snake.cpp.
Checking if we need to remove the back of the snake from the labyrinth(we don't in case it has eaten the Ball)
- Parameters
-
| p | - the desired position of movement |
| change | - 2-dimensional array of changes needed to be applied to the labyrinth |
Definition at line 233 of file snake.cpp.
Moving snake head to a described by parameters position and updating the addition to the labyrinth.
- Parameters
-
| p | - the new head position |
| change | - 2-dimensional array of changes needed to be applied to the labyrinth |
Definition at line 222 of file snake.cpp.
| bool Snake::setDirection |
( |
int |
direction | ) |
|
The method to set the direction where the snake is heading.
- Parameters
-
| direction | - direction of the snake we are trying to set |
- Returns
- - mark of successful set
Definition at line 294 of file snake.cpp.
| void Snake::setScheme |
( |
| ) |
|
| std::deque<Point> Snake::snakeBody |
|
private |
The documentation for this class was generated from the following files:
- /home/travis/build/echo-team/Snoke/app/Snake/snake.h
- /home/travis/build/echo-team/Snoke/app/Snake/snake.cpp