15 #include "../Common/common.h" 16 #include "../Labyrinth/labyrinth.h" 17 #include "../Labyrinth/change.h" 18 #include "../Ball/ball.h" 90 bool init(
Point begin,
short direction,
int length);
92 void getCoords(std::list<Point>* currBody);
short checkIntersection(Point check, Labyrinth *laryrinth)
Checking the given point for intersections with Ball, borders, obstacles.
class for containing and displaying the game field
std::deque< Point > snakeBody
bool move(Labyrinth *labyrinth)
The snake movement on the game field(should be called in each iteration of the game cycle...
const int NOCOLL
the tested segment is NOT intersecting with any Point of the game labyrinth
short checkWisely(Point coords, Point bcoords)
If the Point of the labyrinth we are checking is not free then decide the type of collision...
void moveHead(Point p, Change *change)
Moving snake head to a described by parameters position and updating the addition to the labyrinth...
void getCoords(std::list< Point > *currBody)
The method to get the snake whole body coordinates(x ,y) without giving the direct access...
const int BALL
the tested segment is intersecting with the Ball
short getDirection()
The method to get the current direction without giving the direct access.
std::list< PointStyle > style
bool setDirection(int dir)
The method to set the direction where the snake is heading.
const int WALLLEFT
the tested segment is intersecting with the left boundary of the game field
const int WALLUP
the tested segment is intersecting with the upper boundary of the game field
bool init(Point begin, short direction, int length)
Initializes snake as an entity without ancoring it anywhere.
const int WALLBOT
the tested segment is intersecting with the bottom boundary of the game field
const int MVLEFT
snake's head is moving left
const int COLL
the tested segment is intersecting with a non-boundary Point of the game field
void moveBack(Point p, Change *change)
Checking if we need to remove the back of the snake from the labyrinth(we don't in case it has eaten ...
Point getHeadCoords()
The method to get the coordinates(x, y) of the snake's head without giving the direct access...
const int MVUP
snake's head is moving up
Describes the Snake entity of the game.
const int MVRIGHT
snake's head is moving right
const int WALLRIGHT
the tested segment is intersecting with the right boundary of the game field
Coordinates and style of the cell in console window.
const int MVDOWN
snake's head is moving down