Game Development Reference
In-Depth Information
The answer lies in manually editing the TMX files created by Tiled in Xcode or with a
text editor. Following is the entire contents of the tilemap.tmx file used in this
chapter:
<?xml version = "1.0" encoding = "UTF-8"?>
<map version = "1.0" orientation = "orthogonal" width = "24" height = "16" tilewidth = "40" tileheight = "40">
<tileset firstgid = "1" name = "tiles" tilewidth = "40" tileheight = "40" spacing = "0" margin = "0" >
<image source = "tiles.png" width = "128" height = "128"/>
</tileset>
<layer name = "Tile Layer 1" width = "24" height = "16">
<data encoding = "base64" compression = "zlib">
eJztlN0KgCAMRr9Km+//xBEssLU/Qe8SDuqEM2VMAGgLAc80mRH/Nojl3ycR + Q9G7mU8k0P6H0dhpDubR/OTcHt4OUnxazXI5Cn4vsXz31TmZPq1RcW7rpq/P4t8GqS45P2tPoz6Kev3erEZscz/sPL/+Yc9LqVyBq0=
</data>
</layer>
</map>
I've highlighted in bold the entries you need to modify. Because this is a standard-res-
olution tilemap, you need to multiply all the numeric values by two to convert the
tilemap to a Retina resolution tilemap. Be careful not to change the map's parameters
by accident, especially because both map and tileset have tilewidth and tile-
height parameters. And if you convert a Retina tilemap to standard resolution, you'd
divide the numeric values by two. In that case all the values should be even numbers so
they're divisible by two with no remainder.
You also need to change the source image name so that it uses the tiles-hd.png
image that you can create with TexturePacker as described in Chapter 6 . Then save the
modified tilemap as tilemap-hd.tmx .
Unfortunately this process is tedious and error-prone because you have to do this after
every modification to the tilemap, or you can choose to edit both standard and Retina
resolution tilemaps at the same time—but that's still twice the work, or four times the
work if you want to support standard, Retina, iPad, and Retina iPad resolutions. In that
case, you'd have to keep these files up to date:
▪ Standard resolution: tilemap.tmx and tilemap.png
▪ Retina resolution: tilemap-hd.tmx and tilemap-hd.png
▪ iPad resolution: tilemap-ipad.tmx and tilemap-ipad.png
Search Nedrilad ::




Custom Search