Object parameters with tiled


hello everyone,
(first i apologize if my english is not really good, i hope that it won’t impair understanding).

As i said in the title, I’m encountering a problem with objects created with tiled. Iused the function “createFromObject” of my map object and successfully created all my objects. But the parameters created in tiled are not implemented in my objects.
There is the concerned part of my JSon file:


and i checked the part of the function “createFromObject” that implements the properties and that is:

          for (var property in obj.properties)
                group.set(sprite, property, obj.properties[property], false, false, 0, true);


and it seems that it is totally normal that it doesn’t work with my JSon file so i did a modified function by replacing this by:

            for (var property in obj.properties)
                group.set(sprite, obj.properties[property].name, obj.properties[property].value, false, false, 0, true);

And it works. So it appears that i have no problems but my question is:
Is my version of tiled wrong? Do i have any way to make Compatible JSon files for Phaser2?

I didn’t find much people talking about the parameters with tiled so i’m sorry if this question seems stupid.
Thank you for your answers :slight_smile:



Interesting question because it seems that the property field of the JSon file from Tiled doesn’t mean the same thing in the parameters of the function createFromObject(...) or am I wrong ?

If I am right it can be interesting to open an issue and make Phaser CE compatible with the version of Tiled you’re using (am not sure of this)


the “property” field isn’t the same as “properties” yes.
property is the value incremented if the for loop. Until “properties” in “createFromObjects” correspond to the field “properties” in the JSon, so they correspond. BUT the function group.set needs a key a second parameters and a number is passed (the number property). So the actual function result in giving to the object a property named “0” (and so which can’t be used) which is an object with the parameters “name” set to “nSize”, "value"set to 10 ect. And i think it is not the expected effect of this.

So the modification i made result in an object with a parameter nSize set to 0 which is the expected result.

ps: i didn’t understand why this post is going to be deleted?^^


Never mind about the line where it says post withdrawn It’s not about your post it’s my first answer

Okey so the loop is made on all the fields of the data object (i guess) from the Tiled JSon file, then when we face the obj.properties case it loops with the property variable becasue maybe the version of Tiled is obviously diffrent, so we have better to move on an issue on the official repo to discuss about that


unfortunately I’m not very familiar with it but i posted an issue here:


We’ll check this all together with @samme


if needed, i will send a simplified version of my code to show the two functions working.
(but tomorrow because i’m actually falling asleep^^).
Thanks for paying attention to this :slight_smile:
and see you tomorrow.


See ya Thomas,

By the way, you can take a look at https://medium.com/@schrockn/on-code-reviews-b1c7c94d868c


Besides createFromObjects(), has Phaser CE had any problems with the map?