snakeplusplus/src/snake.cpp

29 lines
523 B
C++
Executable File

// Snake.cpp
#include <queue>
#include <SFML/Graphics.hpp>
#include "common.hpp"
#include "snake.hpp"
void Snake::Pop(void)
{
body.front()->m_bSnake = false;
body.pop();
return;
}
void Snake::Reset(void)
{
while (!body.empty()) Pop();
speed.x = 0;
speed.y = 0;
return;
}
// Returns a new food object for the snakeFood
void Food::GenerateNewFood(sf::Vector2f boundaries)
{
location.x = GenerateRandomNumber(boundaries.x);
location.y = GenerateRandomNumber(boundaries.y);
return;
}