Getting an object from a 2d array inside of a class
Posted
by
user36324
on Game Development
See other posts from Game Development
or by user36324
Published on 2013-10-29T05:54:30Z
Indexed on
2013/10/29
10:22 UTC
Read the original article
Hit count: 195
I am have a class file that contains two classes, platform and platforms. platform holds the single platform information, and platforms has an 2d array of platforms. Im trying to render all of them in a for loop but it is not working. If you could kindly help me i would greatly appreciate.
void Platforms::setUp()
{
for(int x = 0; x < tilesW; x++){
for(int y = 0; y < tilesH; y++){
Platform tempPlat(x,y,true,renderer,filename,tileSize/scaleW,tileSize/scaleH);
platArray[x][y] = tempPlat;
}
}
}
void Platforms::show()
{
for(int x = 0; x < tilesW; x++){
for(int y = 0; y < tilesH; y++){
platArray[x][y].show(renderer,scaleW,scaleH);
}
}
}
© Game Development or respective owner