Added random generation on start

This commit is contained in:
Trimutex 2023-08-18 18:15:21 -05:00
parent 709cf26f99
commit 441c52ab0f

View File

@ -100,10 +100,9 @@ namespace snakeplusplus
char* locationState = &gameBoard.at(player.headLocation.y).at(player.headLocation.x);
player.body.push(locationState);
*player.body.front() = 'O';
playerFood.location.x = 2;
playerFood.location.y = 2;
playerFood.food = &gameBoard.at(2).at(2);
*playerFood.food = 'X';
playerFood.GenerateNewFood(GetGameBoundaries());
sf::Vector2f newLocation = playerFood.location;
gameBoard.at(newLocation.y).at(newLocation.x) = 'X';
return;
}