private void TryToFixCollision(ScreenDrawingSurface surface, Rectangle collision)
{
Point collCenter = collision.Location;
collCenter.Offset(collision.Width / 2, collision.Height / 2);
Point surfCenter = surface.Location;
surfCenter.Offset(surface.Width / 2, surface.Height / 2);
int off_y = surfCenter.Y - collCenter.Y;
int off_x = surfCenter.X - collCenter.X;
if (Math.Abs(off_y) > Math.Abs(off_x))
{
surface.Location = new Point(surface.Location.X, surface.Location.Y + surface.Screen.Tileset.TileSize);
}
else
{
surface.Location = new Point(surface.Location.X + surface.Screen.Tileset.TileSize, surface.Location.Y);
}
}