Dynamic resolution tilesets - misplaced map (drawn starting from one tile to the right)

When I have prepared retina-resolution tile sets, It appeared that the whole map was drawn on wrong position - just like it started drawing one tile to the right (first column of tiles was empty). It worked fine in standard resolution though (iPhone 3gs sim and device), but when switched to retina one it showed that behavior (iPhone 4 sim, iPad and both devices).

the quick and dirty fix is to change in file lime-tile in method Tile:create

1
2
-- Place this tile in the right X position
self.sprite.x = ( ( self.column - 1 ) * self.map.tilewidth ) + self.sprite.width  * 0.5

Putting your change in seems to shift all my tiles one slot to the left?

yes it is - in case of retina-resolution tileset. Thats because without that change - all tiles are shifted one slot right :)

I am preparing the project showing that case.

I have found that, when on iphone4 (or in sim with this device set) - the double sized tilesets were shown right with my fix, then the ones without double resolution counterpart, were moved with my solution one tile to the left, thus - I had to take care of different resolution tilesets used in one map so a much better solution is this one:

1
2
3
4
5
6
-- Place this tile in the right X position
if self.tileSet.usingHDSource then
        self.sprite.x = ( ( self.column - (1 / display.contentScaleX)) * self.map.tilewidth ) + self.sprite.width  * 0.5
else
        self.sprite.x = ( ( self.column - 1 ) * self.map.tilewidth ) + self.sprite.width  * 0.5
end 

Perfect! That works now and thanks again for the fix. I'm loving that the Lime code is open to users :-) Helps smooth over my inadequacies.

views:1326 update:2011/10/13 16:39:51
corona forums © 2003-2011