Jump to content

Import tiled object layer properties with createFromObjects


nkholski
 Share

Recommended Posts

Hi!
 

I've been testing Phaser out for a couple of weeks and love it. I found answers to all my questions by lurking around here, the docs or in the tutorials but one. I'm loading enemies from an object layer of a map made with Tiled, which works great. However I'm not sure if its possible to import properties set in Tiled on each object. 

 

Example:

this.enemyPool contains the result from createFromObjects. In tiled I've added a custom property, "initVelocity". When I access an object in the pool, enemy, I would like the velocity property imported to something like enemy.properties.initVelocity.

 

I have a event-triggering object layer where I managed to access properties per object so if there is no built-in-solution I might just write a function (createFromObjectsProp) myself and share it.

 

thanks,

Niklas

Link to comment
Share on other sites

Thanks, but that thread is about properties set to tiles, not objects with properties. However, I "solved" it. When creating sprites objects with createFromObjects the properties will be added directly to the objects. In my example it would be enemy.initVelocity. EmbarrassingDon't know how I could miss it.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...