for (int x = 0; x < tilemap.GetLength(1); x++)
{
for (int y = 0; y < tilemap.GetLength(0); y++)
{
if (tilemap[y, x] == -1) continue;
if (man.Position.Y > (y * TextureHeight) - TextureHeight && man.Position.Y < y * TextureHeight)
tilesaty.Add(new Vector2(x * 40, y * 40));
}
}
foreach (Vector2 pos in tilesaty)
{
Rectangle rect = new Rectangle((int)pos.X, (int)pos.Y, TextureWidth, TextureHeight);
Rectangle rect2 = new Rectangle((int)man.Position.X, (int)man.Position.Y, (int)(man.mSpriteTexture.Width * man.Scale), (int)(man.mSpriteTexture.Height * man.Scale));
if (rect2.Right >= rect.Right && rect2.Left < rect.Right)
man.Position.X -= 1;
}
Edited by povilaslt2, 15 December 2012 - 01:14 PM.






