Tile Maps Help

Started by
12 comments, last by lodoss118 15 years, 11 months ago
Well, no. You'll have to do this:

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);
while (tired) DrinkCoffee();
Advertisement
wouldn't that be harder to allocate what texures i want in my map

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]);
while (tired) DrinkCoffee();
THANKS GUY LOVE YOU

This topic is closed to new replies.

Advertisement