1
General / Re: [Help] Creating a Map
« on: March 25, 2012, 07:04:15 am »I have a class called Block and a bunch of other classes extend this class. I have a problem however... I want to store all the blocks into an array. However, I am having a problem. The plan is to have the max number of blocks in the game 256 width 512 height. I want to efficiently store these into an array or any method to hold them.
Should I make a list of addresses pointing to them or what?
Erm...probably like this :-
#define width 256;
#define height 512;
cBlock Blocks[width][height]; //An instance of your block class
// render your blocks
For(int i=0; I<width; I++)
{
For(int j=0; j<height; j++)
{
App.Draw(Blocks[i][j]);
}
}
#define height 512;
cBlock Blocks[width][height]; //An instance of your block class
// render your blocks
For(int i=0; I<width; I++)
{
For(int j=0; j<height; j++)
{
App.Draw(Blocks[i][j]);
}
}