Added random generation on start
This commit is contained in:
parent
709cf26f99
commit
441c52ab0f
@ -100,10 +100,9 @@ namespace snakeplusplus
|
|||||||
char* locationState = &gameBoard.at(player.headLocation.y).at(player.headLocation.x);
|
char* locationState = &gameBoard.at(player.headLocation.y).at(player.headLocation.x);
|
||||||
player.body.push(locationState);
|
player.body.push(locationState);
|
||||||
*player.body.front() = 'O';
|
*player.body.front() = 'O';
|
||||||
playerFood.location.x = 2;
|
playerFood.GenerateNewFood(GetGameBoundaries());
|
||||||
playerFood.location.y = 2;
|
sf::Vector2f newLocation = playerFood.location;
|
||||||
playerFood.food = &gameBoard.at(2).at(2);
|
gameBoard.at(newLocation.y).at(newLocation.x) = 'X';
|
||||||
*playerFood.food = 'X';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user