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 :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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.