[C# XNA] probleme tileLayer

Fermé
Exec57 Messages postés 1 Date d'inscription mardi 27 septembre 2011 Statut Membre Dernière intervention 14 avril 2012 - 14 avril 2012 à 12:20
Bonjour a tous.

Je rencontre un problème sur ma classe TileLayers.
J' aimerez mettre un rectangle de collision pour chaque tile mais je n'y arrive pas.

Voici ma classe TileLayers :

public class TileLayer
{
public int tileWidth = 25;
public int tileHeight = 24;
int[,] map;
public int tileMapWidth;
public int tileMapHeight;
public int index;

public TileLayer(int width, int height)
{
map = new int[width, height];
}
public TileLayer(int[,] existMap)
{
map = (int[,])existMap.Clone();
}
public void Update(GameTime gameTime)
{
tileMapWidth = map.GetLength(1);
tileMapHeight = map.GetLength(0);
}
public void Draw(SpriteBatch spriteBatch)
{
for (int x = 0; x < tileMapWidth; x++)
{
for (int y = 0; y < tileMapHeight; y++)
{
Texture2D texture;
index = map[y, x];
texture = Main.tilesTexture[index];;
spriteBatch.Draw(texture, new Vector2(x * tileWidth - (int)Main.camera.position.X, y * tileHeight - (int)Main.camera.position.Y), Color.White);
}
}
}
}


Pouvez vous m'aidez svp ? :)
Merci d'avance.