Check out the new forum. You are currently viewing the old forum. It will be saved and searchable for future reference.

HomeForumGeneral DiscussionTiled property info

Author Posts
Author Posts
November 15, 2010 at 11:26 pm #244

Renegade

Can anyone tell me where to find info on the tiled layer properties?
i’ve looked all over mapedetor.org and its wiki
and lots of web searches
for info on all the different layer properties

November 16, 2010 at 2:40 am #850

stahlmanDesign

I’m not quite sure what you mean. If you are looking where to enter properties, right-click on a layer.

As far as properties go, they are endless, because you can make your own.

When you make a property called obstacles and set the value to 1, it just writes that message in the XML file.

It’s the GameKit code that uses checks for the property obstacles to determine if a tile is tangible or not.

For example, in my game I created a proptery called ladders and set it to 1.

Then in my modified game kit in the Level.m class I have it check to see if the tile has the property of ladders, which then allows my character to climb up or down through that tile.

November 16, 2010 at 6:23 pm #854

Renegade

I ment
Where do u find where the properties r defined?
Like obstacles, cc_vertexz, foreground, offset
I ask because
I’m having trouble getting my trees to work
I have the layer properties set as
cc_vertex automatic
obstacles 1
foreground 1
xoffset -32
My own trees aren’t working and I have set them up exactly like the kit
Is there something I’m missing?
I’ve tried searching for where the layer properties r defined so I can trouble shoot it

November 16, 2010 at 7:10 pm #855

stahlmanDesign

Take a look in Level.m

You’ll see here that I have added a @”ladders” property to my code.


-(void) layerInit:(CCTMXLayer*)layer
{
// is it an obstacle layer?
if([layer hasProp:@"obstacles"])
[obstacleLayers addObject:layer];

// is it a ladder layer? -------------------------------------------------
if([layer hasProp:@"ladders"])
[ladderLayers addObject:layer];

// is it a destroyable layer?
if([layer hasProp:@"destroyable"])
[destroyableLayers addObject:layer];

// is it hidden?
if([layer hasProp:@"hidden"])
[layer setVisible:NO];

// set a constant z height
if(![[layer propertyNamed:@"cc_vertexz"] isEqualToString:@"automatic"])
[layer setVertexZ:-1000.0f + layerCount];

// offset the layer?
CGPoint offset = [layer props2point:@"xoffset" y:@"yoffset"];
if(offset.x || offset.y)
layer.position = ccpAdd(layer.position, offset);

// smooth the edges of the tiles
[self smoothTiles:layer];

layerCount++;
}

November 16, 2010 at 11:05 pm #859

Nathanael Weiss

Renegade, the properties you can define for Quexlor levels are defined in the level building chapter on page 28-29.

Your trees aren’t working? Hmmm… Did you accidentally hide the layer? It needs to have a checkmark (in Tiled) next to the layer name to be visible. If that isn’t working then perhaps you accidentally drew a tile from a different tileset (other than the trees tileset) into your trees layer. There can never be two tilesets in one layer. Cocos2D doesn’t like that at all.

If you still are having challenges, I recommend starting over with a very simple, small level with a background layer, some trees and a player object. Maybe leave out the background layer at first so you only have one tileset (the trees). You will figure it out! :)

November 17, 2010 at 9:00 pm #867

Renegade

it still doesnt work
here is the tmx file
maybe u can tell me what im doing wrong

<?xml version=”1.0″ encoding=”UTF-8″?>
<map version=”1.0″ orientation=”orthogonal” width=”50″ height=”50″ tilewidth=”64″ tileheight=”64″>
<tileset firstgid=”1″ name=”grundvari tileset” tilewidth=”64″ tileheight=”64″>
<image source=”grundvari tileset.png”/>
</tileset>
<tileset firstgid=”193″ name=”trees” tilewidth=”64″ tileheight=”64″>
<image source=”trees.png”/>
</tileset>
<layer name=”Tile Layer 1″ width=”50″ height=”50″>
<data encoding=”base64″ compression=”gzip”>
H4sIAAAAAAAAA+3DwQkAAAwDoXtk/5k7R0HBVVNVVVVVVVVVVdXnDwn5PbEQJwAA
</data>
</layer>
<layer name=”trees” width=”50″ height=”50″>
<properties>
<property name=”cc_vertexz” value=”atomatic”/>
<property name=”foreground” value=”1″/>
<property name=”obstacles” value=”1″/>
<property name=”xoffset” value=”-32″/>
</properties>
<data encoding=”base64″ compression=”gzip”>
H4sIAAAAAAAAA+3RMQoAIAwDwP7/u7rpYBdB3Nws3EHIHBJBBS3Tj65qZObRVffcf+w91fjjL/cfAAAAAAAAAAC8WTVN4u0QJwAA
</data>
</layer>
<objectgroup name=”Object Layer 1″ width=”50″ height=”50″>
<object name=”” type=”player” x=”321″ y=”269″/>
</objectgroup>
</map>

November 17, 2010 at 9:23 pm #870

Nathanael Weiss

Did you try starting over from scratch yet?

November 18, 2010 at 3:46 am #872

Renegade

yup just ground, trees, player layers

November 18, 2010 at 4:04 pm #873

Renegade

i have my trees layer properties set as the kit says
</layer>
<layer name=”trees” width=”50″ height=”50″>
<properties>
<property name=”cc_vertexz” value=”atomatic”/>
<property name=”foreground” value=”1″/>
<property name=”obstacles” value=”1″/>
<property name=”xoffset” value=”-32″/>
</properties>

it still dosent work
when i build and run it
i cannot walk behind the tree or even get close to it
there must be something im missing

November 18, 2010 at 5:33 pm #874

stahlmanDesign

Is it because you misspelled automatic ?

<property name="cc_vertexz" value="atomatic"/>

November 18, 2010 at 8:16 pm #875

Renegade

oh crap
u would think that would matter
so i changed it but samething

<?xml version=”1.0″ encoding=”UTF-8″?>
<map version=”1.0″ orientation=”orthogonal” width=”50″ height=”50″ tilewidth=”64″ tileheight=”64″>
<tileset firstgid=”1″ name=”grundvari tileset” tilewidth=”64″ tileheight=”64″>
<image source=”grundvari tileset.png”/>
</tileset>
<tileset firstgid=”193″ name=”trees” tilewidth=”64″ tileheight=”64″>
<image source=”trees.png”/>
</tileset>
<layer name=”Tile Layer 1″ width=”50″ height=”50″>
<data encoding=”base64″ compression=”gzip”>
H4sIAAAAAAAAA+3DwQkAAAwDoXtk/5k7R0HBVVNVVVVVVVVVVdXnDwn5PbEQJwAA
</data>
</layer>
<layer name=”trees” width=”50″ height=”50″>
<properties>
<property name=”cc_vertexz” value=”automatic”/>
<property name=”foreground” value=”1″/>
<property name=”obstacles” value=”1″/>
<property name=”xoffset” value=”-32″/>
</properties>
<data encoding=”base64″ compression=”gzip”>
H4sIAAAAAAAAA+3RMQoAIAwDwP7/u7rpYBdB3Nws3EHIHBJBBS3Tj65qZObRVffcf+w91fjjL/cfAAAAAAAAAAC8WTVN4u0QJwAA
</data>
</layer>
<objectgroup name=”Object Layer 1″ width=”50″ height=”50″>
<object name=”” type=”player” x=”321″ y=”269″/>
</objectgroup>
</map>

still cannot walk behind the tree or get close

November 19, 2010 at 5:28 am #876

Nathanael Weiss

To solve your challenge, I copied your level, found the groundvari tileset.png, installed them both, and ran the level in the simulator. Now I see what you mean. You can’t walk near the pillars. Here’s why. The trees tileset has been added as 64×64 tiles, effectively creating a necessity of four tiles per tree. That’s fine, but the way the level is created, you’ve got all four tiles on an obstacle layer. This makes all four tiles obstacles that cannot be walked on or behind. Does it make sense now?

You could solve this two ways and I recommend trying both so you understand what’s going on even deeper.

1) Create another tree layer that does not have the obstacles property. Draw three of the tree tiles on this obstacle-free layer. You will then be able to walk on these tiles.

2) Create another test level, but this time add your trees tileset with 128 by 128 tiles. This is how the Quexlor game does it. Only the bottom-left tile will be recognized as an obstacle. Everything should work peachy keen that way.

November 20, 2010 at 12:08 am #881

Renegade

thanks
it works great now
and now i know what i did wrong
and thanks for the great support
take care