snakeplusplus/src/snake.cpp

29 lines
514 B
C++
Raw Normal View History

// Snake.cpp
#include <queue>
#include <SFML/Graphics.hpp>
2023-08-18 19:09:57 -05:00
#include "common.hpp"
#include "snake.hpp"
void Snake::Pop(void)
2023-03-12 08:50:50 -05:00
{
*(body.front()) = ' ';
body.pop();
return;
}
void Snake::Reset(void)
{
while (!body.empty()) Pop();
speed.x = 0;
speed.y = 0;
return;
}
2023-08-10 18:47:40 -05:00
// 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;
}