I'm using Mobile Bros wrapper for Chipmunk, and I'm trying to iterate over a TMXTiledMap to place chipmunk bodies where the tiles are. In order to debug, I'm also placing an additional tile over the top so I can visually check where the bodies are being placed.
However, while I'm getting the right number of bodies placed, and whilst most of them are in exactly the right place, for some reason 2 rows of tiles aren't where they should be. As this image illustrates (the yellow tiles are the chipmunk bodies)

And since I'm getting the right number of bodies to tiles, I know it's not skipping any rows. Here's the loop if anyone can see what I'm doing wrong.
// Add bodies to tiles
for(int yPos = 0; yPos < map.mapSize.height; yPos++){
for(int xPos=0; xPos < map.mapSize.width; xPos++){
int tGID = [mapLayer tileGIDAt:cpv(xPos,yPos)];
if(tGID != 0){
NSString *tileID = [NSString stringWithFormat:@"Tile --> %d at xPos=%d; yPos=%d", tGID, xPos, yPos];
NSLog(tileID);
cpShape *tmpRect = [world addRectAt:cpv((xPos * 32) + 20,(yPos * 32) + 20) mass:STATIC_MASS width:32 height:32 rotation:0];
cpSprite *tmpTile = [cpSprite spriteWithShape:tmpRect file:@"demo-tile.png"];
[self addChild:tmpTile];
}
}
}
Any help greatly appreciated, this has been bugging me for two days.