Moved general functions to a general file

Moved general functions to a general file and added a statement to catch if  the newly generated location is the same. The snake food is not currently generating to a new random location like expected and is broken.
This commit is contained in:
TriantaTV
2022-08-17 00:41:29 -05:00
parent cc3a61abb7
commit 88902fed6a
6 changed files with 65 additions and 48 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ GameState::GameState(int newHorizontal, int newVertical)
void GameState::startNewGame()
{
gameWindow.create(gameVideoMode, "SnakePlusPlus");
sf::Time delay = sf::milliseconds(50);
sf::Time delay = sf::milliseconds(100);
int snakeDirection = 0;
Snake player(sf::Vector2f(25,25));
SnakeFood playerFood(sf::Vector2f(25,25));