Allegro 5 tile map

so what i am trying to do is make a tile map using 0 and 1 and 2 tiles on a png file.

what happens is that it only loads the first column of the sprites going down.

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
    int map[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};


    int xoff = 0;
    int yoff = 0;
    
    int mapColums = 10;
    int mapSize = 100;
    int tileSize = 32;

ALLEGRO_BITMAP *bgSheet = NULL;

bgSheet = al_load_bitmap("Tiles.png");

for(int i = 0; i < mapSize; i++)
              {
                   al_draw_bitmap_region(bgSheet, tileSize * map[i], 0, tileSize, tileSize,
                        xoff + tileSize * (1 % mapColums), yoff + tileSize * (i / mapColums), 0);
              }
(1 % mapColums) Perhaps a typo?
thank you. it was supposed to be i. not 1.
Topic archived. No new replies allowed.