I have a method here that returns true if a collision is detected between the player and tile.
private bool CheckCollision()
{
foreach (CollisionTile tile in map.CollisionTiles)
{
if (tile.TileType == "stone" && player.rectangle.Intersects(tile.Rectangle))
{
return true;
}
if(tile.TileType == "water" && player.rectangle.Intersects(tile.Rectangle))
{
return true;
}
}
return false;
}
The collision detection works fine but when I try to move away from the tile I don't move at all. What could be my problem here?
if (!CheckCollision())
{
player.Update();
}
this is in my update method.