Jump to content

Creating Object Layer in Phaser


zazou
 Share

Recommended Posts

Spent a ridiculous amount of time trying to create an object layer in phaser. What is the best way to do this? I can't seem to find a simple, elegant solution to this seemingly very basic problem.

I understand that map.createLayer will only work for tilemap layers. Is there not something that will do the same for object layers?

I can see that my objects exist in the map object. the output of my map.object i have attached as a PNG screenshot.

Just a couple of door objects, defined in Tiled.  I just want to create a couple of doors! Can anyone help me out!

Thanks!!!!

Sam

 

post-8567-0-43848400-1428950426.png

Link to comment
Share on other sites

I managed to get this working following this guide and refactoring my code so that i was using 'this' rather than the global scope. The tutorial seems to gloss over some important parts of the 'Tiled' user set up, but i'd recommend looking at the example file, and how they have set up their .JSON files if your having troubles. 

http://www.gamedevacademy.org/html5-phaser-tutorial-top-down-games-with-tiled/

Link to comment
Share on other sites

That's pretty much what I'm doing in my game. Each object has a "name" property that I can map to a specific Sprite child class and pass in any additional properties to it.

 

Some of the objects I make in Tiled aren't Sprites at all but regions that other systems in the game care about like spawn points, etc. But I'm basically special casing those individually.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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