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

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

to:

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

I am not sure it is the best solution, because I have done it really fast, and I have a “warning sign” blinking in my mind - I really didn’t read through that code close to be sure. Perhaps it just fixes the bug, and doesn’t remove the cause… [import]uid: 10881 topic_id: 6855 reply_id: 306855[/import]

Putting your change in seems to shift all my tiles one slot to the left? [import]uid: 5833 topic_id: 6855 reply_id: 23935[/import]

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

I am preparing the project showing that case. [import]uid: 10881 topic_id: 6855 reply_id: 23999[/import]

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:

-- 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 [import]uid: 10881 topic_id: 6855 reply_id: 24016[/import]

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

[import]uid: 5833 topic_id: 6855 reply_id: 24029[/import]