I have a c++ problem.
So I have a base GAME class. In this class I have an instance of the player class. I want to check this player for collision with tiles. Tiles are also stored in the game class. How do I get the instance of these tiles.
I tried passing in an instance of the game class into the constructor of the player class and accessing it that way, but no success.
So for example:
Class game()
{
Player p(x, y);
Tile t(x, y);
//game loop
p.update(); //check collision
p.render();
t.render();
}
Player::Player(int x, int y)
{
this.x = x;
this.y = y;
}
Player::update()
{
//get an the instance of tile to check the collision
}