Snake is now planned to use a deque for location of body. Split snake into separate file outside of main.
31 lines
547 B
C++
31 lines
547 B
C++
//Snake.h
|
|
#ifndef SNAKE_H
|
|
#define SNAKE_H
|
|
#include <queue>
|
|
|
|
bool SnakeCollision(sf::RectangleShape object1, sf::RectangleShape object2);
|
|
void SnakeMovement(sf::Keyboard keyboard);
|
|
|
|
class SnakeNode
|
|
{
|
|
private:
|
|
// sf::RectangleShape snakeBody(sf::Vector2f(25,25));
|
|
sf::Vector2f snakeBodyLocation;
|
|
SnakeNode* next;
|
|
public:
|
|
SnakeNode();
|
|
SnakeNode(sf::Vector2f addBodyPiece);
|
|
};
|
|
|
|
class Snake
|
|
{
|
|
private:
|
|
std::deque<sf::Vector2f> snakeBody;
|
|
public:
|
|
void ExtendSnake(sf::Vector2f newLocation);
|
|
void MoveSnake();
|
|
};
|
|
|
|
|
|
#endif
|