ibly31 wrote:If you can't think of any way to implement this, I think this might be a bit too complex for you, maybe you should start with something easier. I've only used SDL, but what I did was load a tilesheet, and have an array,
int levelData[SizeX][SizeY];
and it would have a 1 for the first tile in the tilesheet, and whatever tile you want appearing at that specific place. To load, I used fstream, and I parsed through the file for integers, and then loaded them into the leveldata. To display, I just clipped the section of the tilesheet and displayed it at the X,Y coordinates of the levelData * however wide/tall your sprites are.
well, in allegro, im doing somethinglike this:
Code: Select all
if([i]right mouse button down)[/i]
{
map[x][y] = selectedtile;
thats how i get the map to be updated but i dont know how to get the tiles i lay on the screen
Code: Select all
for(int i; i<20; i++)
{
for(int j; j<50; j++)
{
switch(map[i][j])
{
case 1:
masked_blit(tset,buffer, 32, 0, j*32, i*32, 32, 32);
case 2:
masked_blit(tset,buffer, 32*2, 0, j*32, i*32, 32, 32);
case 3:
masked_blit(tset,buffer, 32*3, 0, j*32, i*32, 32, 32);
case 4:
masked_blit(tset,buffer, 32*4, 0, j*32, i*32, 32, 32);
case 5:
masked_blit(tset,buffer, 32*5, 0, j*32, i*32, 32, 32);
}
}
}
masked_blit() will just draws the tile on the screen.