The World class
Our snake can now move and collide with itself. While functional, this doesn't make a really exciting game. Let's give it some boundaries and something to munch on to increase the score by introducing the World
class.
While it's possible to just make separate objects for everything we talk about in here, this project is simple enough to allow certain aspects of itself to be nicely contained within a single class that can manage them without too much trouble. This class takes care of everything to do with keeping the game boundaries, as well as maintaining the apple the player will be trying to grab.
Let's take a look at the class header:
class World{ public: World(sf::Vector2u l_windSize); ~World(); int GetBlockSize(); void RespawnApple(); void Update(Snake& l_player); void Render(sf::RenderWindow& l_window); private: sf::Vector2u m_windowSize; sf::Vector2i m_item; int m_blockSize; sf::CircleShape m_appleShape; sf::RectangleShape...