int tilemap[5*5];for (int x = 0; x < 5; x++){ for (int y = 0; y < 5; y++) { tilemap[access2D(x, y, 5)] = 0; }}CMap* map = new CMap("SKYLEVEL1", 1, 5, 5, tilemap);
Tile Maps Help
Well, no. You'll have to do this:
wouldn't that be harder to allocate what texures i want in my map
i.e using
much easier this way, is there anyway to do it this way??
i.e using
int MAP1[2][2] = {0,2, 1,0};
much easier this way, is there anyway to do it this way??
Yes you can do that if you want, but you still need to treat the multidimensional array as an 'int*' when passing it to functions.
// Use this function when accessing the multidimensional array represented as an 'int*'inline unsigned int std2D (unsigned int x, unsigned int y, unsigned int width){ return (x*width)+y;}int tilemap[2][2] = {{1, 2}, {3, 4}};CMap* map = new CMap("SKYLEVEL1", 1, 2, 2, &tilemap[0][0]);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement