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);
}
|