I'm making a maze game where the maps are saved in PROGMEM as an uint8_t 2d array.
Example:
static const uint8_t PROGMEM
map1[]=
{ B00000000,
B01111100,
B01000000,
B01011111,
B01000000,
B01111110,
B00000010,
B11111000 };
map2[]=
{ B00000000,
B01000000,
B01000000,
B01011001,
B01000000,
B01100110,
B00000010,
B11011000 };
I'm stuck on figuring out how to dynamically change the map by pointing to a different map number such as "map1" or "map2" to use when calling Adafruit_GFX with matrix.drawBitmap(0,0,mapHolder,8,8,LED_RED); I have success making a pointer called uint8_t *mapHolder and then making mapHolder=map1; but I want to build up the name "map" and the "number" with two separate variables.
I figure I have to break the problem down in two steps: The first being to combine the word "map" with the number.
char mapName[1];
char mapNum[1];
void setup(){
mapNum[1]=1;
strcpy(mapName,"map");
strcat(mapName,mapNum[1]);
Serial.println(mapName);
}
This code only works if I put "1" where "mapNum[1]" is.
Then the second step would be to convert that char or somehow just cast it into (uint8_t *)mapName?
mapHolder=(uint8_t *)mapName;
Thanks for any help in advance!