Reputation: 554
In my cocos2d iphone project , I am trying to add tiled map. Tiled map has only one image layer.I am trying to add this tiledMap by below code.
-(id) init
{
if( (self=[super init])) {
theMape = [CCTMXTiledMap tiledMapWithTMXFile:@"demomap.tmx"];
[self addChild:theMape z:1];
}
return self;
}
and source of my tile map is:
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="20" height="180" tilewidth="32" tileheight="32">
<tileset firstgid="1" name="block" tilewidth="32" tileheight="32">
<image source="block.png" width="90" height="34"/>
<tile id="0">
<properties>
<property name="type" value="base"/>
</properties>
</tile>
</tileset>
<imagelayer name="backgorund" width="20" height="180">
<image source="bgimage.png"/>
</imagelayer>
</map>
And i have bgimage.png file in my resource folder.
when it contains only tile layer than it will display that layer. I don't know what is wrong with this?
Upvotes: 0
Views: 125
Reputation: 64477
cocos2d-iphone does not support Tiled's image layer, only tile layers.
Upvotes: 1