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.

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,

?:)

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

1
2
3
4
{
    "HasBody" : "",
    "bodyType" : "static"
}

Would it work with objects rather than tiles?

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.

@ 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

views:1313 update:2011/10/13 16:30:09
corona forums © 2003-2011