Loading Object properties via text file?

Hi,

Is there a way to load object properties from a text file rather than having to edit the objects via tiled?

For example having walls on the map which all load a same set of properties from a text file. [import]uid: 75783 topic_id: 12984 reply_id: 312984[/import]

you can use the PropertyBag class, but you will have to save the set the first time and then everytime you load start the app, all of it will be loaded and available to your app.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 12984 reply_id: 47646[/import]

You can right click a tile in Tiled, select Tile Properties, and give it a property name of configFile and a property value such as tiles/ground.json

Then in your directory you create a tiles folder, a ground.json file inside it with values such as

{  
 "HasBody" : "",  
 "bodyType" : "static"  
}  

You can then export the tileset from Tiled to be used in other Tiled maps. Hope that helps! [import]uid: 63884 topic_id: 12984 reply_id: 47647[/import]

Would it work with objects rather than tiles? [import]uid: 75783 topic_id: 12984 reply_id: 47648[/import]

It works exactly the same way. For instance you can also put in

“type” : “PlayerSpawn”

and then use an eventlistener to look for PlayerSpawn and spawn the character. [import]uid: 63884 topic_id: 12984 reply_id: 47650[/import]

@ chalitnc - I was about to say configFiles but you have already beaten me to it, thank you very much! It’s really good to see people using features like that.

@ komirad - If you have any questions about how it can work, this should hopefully help - http://justaddli.me/tutorial.php?t=0&id=14 [import]uid: 5833 topic_id: 12984 reply_id: 47655[/import]