Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Tiled Object Templates #9

Open
swidku opened this issue Apr 6, 2020 · 2 comments
Open

Support for Tiled Object Templates #9

swidku opened this issue Apr 6, 2020 · 2 comments

Comments

@swidku
Copy link

swidku commented Apr 6, 2020

As far as I can tell TiledLib doesn't support Tiled Object templates. Am I missing something or has it not been implemented? When ever I try and load my map with template objects it just errors out with InvalidOperationException "There is an error in XML document".
Tiled Template Docs

Thanks

@Ragath
Copy link
Owner

Ragath commented Apr 7, 2020

Unfortunately I've missed this feature when updating to the new *.tmx versions. If you'd be willing to share the tmx of your map, it would help locate the issue and ensure there aren't any other errors keeping it from parsing.

@swidku
Copy link
Author

swidku commented Apr 7, 2020

So it looks like normal objects are stored here like normal but template objects reference a normal file. Side note: you can also add extra data onto the templated objects aswell on a per instance base.

Heres it the object layer:
<objectgroup id="5" name="entity_layer"> <object id="106" gid="27" x="382" y="390.333" width="16" height="16"> <properties> <property name="entity" value="player_spawn"/> </properties> </object> <object id="120" template="TiledTemplates/chicken_entity.tx" x="656.667" y="391.333"/> <object id="121" template="TiledTemplates/crate_entity.tx" x="495.333" y="418.667"> <properties> <property name="someextra" value="extra data"/> </properties> </object> </objectgroup>

Here is a template file:
<?xml version="1.0" encoding="UTF-8"?> <template> <tileset firstgid="1" source="../chicken.tsx"/> <object gid="1" width="16" height="16"> <properties> <property name="entity" value="EntityChicken"/> </properties> </object> </template>

Sorry about the formatting here is a quick formatter if you need it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants