2022-07-25 15:40:45 -05:00
|
|
|
//Snake.h
|
|
|
|
#ifndef SNAKE_H
|
|
|
|
#define SNAKE_H
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
bool SnakeCollision(sf::RectangleShape object1, sf::RectangleShape object2);
|
2022-07-26 19:03:55 -05:00
|
|
|
int SnakeMovement();
|
|
|
|
sf::Vector2f CalculateNewPosition(int direction, sf::Vector2f position);
|
2022-07-25 15:40:45 -05:00
|
|
|
|
2022-07-25 15:43:42 -05:00
|
|
|
// class SnakeNode
|
|
|
|
// {
|
|
|
|
// private:
|
|
|
|
// // sf::RectangleShape snakeBody(sf::Vector2f(25,25));
|
|
|
|
// sf::Vector2f snakeBodyLocation;
|
|
|
|
// SnakeNode* next;
|
|
|
|
// public:
|
|
|
|
// SnakeNode();
|
|
|
|
// SnakeNode(sf::Vector2f addBodyPiece);
|
|
|
|
// };
|
2022-07-25 15:40:45 -05:00
|
|
|
|
|
|
|
class Snake
|
|
|
|
{
|
|
|
|
private:
|
2022-07-25 16:06:06 -05:00
|
|
|
std::deque<sf::RectangleShape> snakeBody;
|
2022-07-25 15:40:45 -05:00
|
|
|
public:
|
2022-07-26 16:56:26 -05:00
|
|
|
Snake();
|
|
|
|
Snake(sf::Vector2f head);
|
2022-07-25 16:06:06 -05:00
|
|
|
// Instead of popping like in MoveSnake()
|
|
|
|
// Simply add to deque
|
2022-07-26 19:03:55 -05:00
|
|
|
sf::Vector2f GetSnakeHeadPosition();
|
|
|
|
sf::RectangleShape GetSnakeHead();
|
|
|
|
void DisplaySnake(sf::RenderWindow& window);
|
2022-07-25 16:06:06 -05:00
|
|
|
void ExtendSnake();
|
2022-07-26 19:03:55 -05:00
|
|
|
void MoveSnake(int snakeDirection); // Move only head body piece
|
2022-07-25 15:40:45 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|