by Game A Gogo » Fri Jul 15, 2011 3:45 pm
For objects, this method is preferred. But for tiles, the other way around is preferred! Since the x and y position of tiles needs not to be pin-point precise (You don't need a tile of 1 pixel offset from the other...)
So one method consist of storing attributes from an object
So you need to store: X, Y, Type, number of objects
Something like: Objects[object_ID][attributes(x,y,type)]
The other method consist of only storing the type of tile
So you only need to store Type
something like: Tiles[x][y]
Now Tiles[x][y] is a map. array [0][0] is position 0,0 in tile form and [10][10] is position 10,10, so [x][y] is x,y...
now in each position, we will store the type of tile found. 0 would mean empty!
That way tile positioning is more reliable. The other method causes too much trouble for simple tiles, and you could end up with two tiles on one (how undesirable!)
Maybe this helped a little... It'd take me much longer to go into details!
Programming games is an art,