Hey forum, I have a small problem with my map loading function.
The initial map loads perfectly fine, but when I load the second it shows a black screen where I can still see my hero (but no other tiles and he hasn't moved like he's supposed too) and crashes.
This is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13
void newMapTile::onCollision(Game& game)
{
game.map = new Map(game.t, fileName);
int newX, newY;
cout<<"calling";
newX = x*32 - game.player.pSprite.GetPosition().x; //calculating new position of player
newY = y*32 - game.player.pSprite.GetPosition().y; //x and y are class members.
game.player.move(newX, Player::LEFT); //move the player in that direction
game.moveWindow(Player::LEFT); //move view (camera)
game.player.move(newY, Player::UP);
game.moveWindow(Player::UP);
}