You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#pragma once
#include <list>
#include "Point.h" //the library we need to implement the snake
#include "Snack.h"
#define BODY 'o'
class Snake{ private: std::list<Point> snake; //the snake will be implemented as a list of points where the first element is the head
graphics_input direction; void updateHead(void); void printSnake(void); public: Snake(int headY = LINES/2, int headX = COLS/2); //default constructor
~Snake(); //destructor
//basic move functions
void moveUp(void); void moveDown(void); void moveLeft(void); void moveRight(void);
bool isBitten(void); //function to check if the snake bit its self
bool hasBitSnack(int snackY, int snackX);//checks if the snake has bitten a snack
bool hasCrashedWall(void); // method to check if the snake crashed the walls
int getSize(void); //get the current length
void incSize(void); //function to increase the length
void move(void); //function to refresh the image of the snake
};
|