[solved] lazy foo tiling trouble
Posted: Sun May 02, 2010 10:36 pm
I am trying to do Lazy foo's tiling tutorial, and am having trouble following it, is there a better tutorial on this subject?
the problem I am having is understanding the following code.
I understand that it initialises the class creates a pointer of it, what I don't get is what is the array about?
Tile class
the problem I am having is understanding the following code.
I understand that it initialises the class creates a pointer of it, what I don't get is what is the array about?
Code: Select all
Tile *tiles [TOTAL_TILES];
Code: Select all
class Tile
{
private:
//The attributes of the tile
SDL_Rect box;
//The tile type
int type;
public:
//Initializes the variables
Tile( int x, int y, int tileType );
//Shows the tile
void show();
//Get the tile type
int get_type();
//Get the collision box
SDL_Rect get_box();
Tile::Tile( int x, int y, int tileType )
{
//Get the offsets
box.x = x;
box.y = y;
//Set the collision box
box.w = TILE_WIDTH;
box.h = TILE_HEIGHT;
//Get the tile type
type = tileType;
}
};