A multidimentional array to a class.
This is a tiledata, each number represents a sprite:
Code:
int my_house_area[10][10] =
{
{
1,2,3,4,5,6,7,8,9,10
}
,
{
1,2,3,4,5,6,7,8,9,10
}
,
{
1,2,3,4,5,6,7,8,9,10
},
{
1,2,3,4,5,6,7,8,9,10
}
,
{
1,2,3,4,5,6,7,8,9,10
}
,
{
1,2,3,4,5,6,7,8,9,10
},
{
1,2,3,4,5,6,7,8,9,10
}
,
{
1,2,3,4,5,6,7,8,9,10
}
,
{
1,2,3,4,5,6,7,8,9,10
}
,
{
1,2,3,4,5,6,7,8,9,10
}
};
The initilization code:
Code:
void LoadStage::SetStage( int area[10][10]){
this->area[10][10]=area[10][10];
for(int y = 0; y<10; y++) {
for(int x = 0; x<10; x++) {
draw_sprite(buffer,sprites[area[x][y]],x*32,y*32);
}
}
}
The code does work if I make "sprites[1]" (1-10), and the "sprites" considers more than 10 bitmaps.