So i am working on a platformer which has tiled graphics. The physics system on the other hand is not tiled, it uses vector boxes as an efficient way of doing collisions and the actual tiling is done at draw time.

Heres the problem, all of my tiles are 16x16px and so the best way to store level data is via a 2d array and looping threw it to create the collision boxes. What happens here is the reasoning behind using bounding boxes is lost as you now have an array of boxes just as you have tiles. So far i've been able to do horizontal grouping of the tiles so {1,1} translates to a 32x16 box using the following code in my level parser:

static void load(list<Platform*>* &platforms, int lvData[][MLVSIZE], int w, int h, CL_InputDevice keyboard){
		for(int y = 0; y < h; y++){
			for(int x = 0; x < w; x++){
				if(lvData[y][x] != 0){
					int xl = x;
					while(lvData[y][xl] != 0){
					platforms->push_back(new Platform(keyboard, x*TILESIZE, y*TILESIZE, (xl-x)*TILESIZE, TILESIZE));
					x = xl;

While it works fine for long lines of tiles, it dose not however work for vertical tiles and i can't seem to get my head around how to do both in parallel without overlapping etc.

If anyone has a solution of perhaps can give me a tutorial in the math required for this(i am horrible at math >.>) i'd really like to hear it ^D^

Sorry for double post but heres an image explaining what i want to do:

As you can see horizontal tiles are prioritised and then the vertical is calculated.