Jump to content

Phaser / tiled / object layers


Recommended Posts

Hi Guys

Basically i'm making a game that is basically a water level.  I've been fooling around with tiled and I have something kinda ok (see 1st attached image) but getting that to display properly is 

really frustrating me! Any help would be appreciated!


Here's the gist - on my tiled_collision_layer is the walls and 2 platforms.
On the tiled_animated_layer (object layer) is all the seaweed.
I added the seaweed to the object layer because I wanted to add in all those to phaser as sprites and have them tween at different angles at different times.
Trying to produce a swaying effect, like they were under water.
I'm bringing in the objects layer with the 
this.levelMap.createFromObjects(blah, blah, blah...)

and assigning them to a group. Like the official phaser example: 




That did not work - the sprites that did make over are hidden behind the walls and platforms and are not in the same positions that they are in Tiled.


In Tiled I have rotated them and placed them without respect to the grid (see attachment 2).


Am I barking up the right tree here?  Should I be using Tiled for the seaweed at all? Should I just add the sprites manually in a group in phaser an tween them from there.


I assume that would be costly and doing this tiled/tilemaps gives better performance.


Any ideas/experiences on working with object layers?


Thank you.





Link to comment
Share on other sites

the only thing i can say here is that i know these problems very well..  i create all my game objects from tiled objects ... depending on their ID i assign them to different groups and then i call group.forEach()  on every group..


what happens next is besides all the settings those objects need (physics) of course the x and y adjustment.   tiled seems to measure the x and y position a little bit different and activating physics on a sprite changes the anchor to 0.5,0.5 therefore ALL my objects are out of place..     but it's not a big deal..  just find out the right adjustment and apply it in your code..  

Link to comment
Share on other sites

Phaser doesn't support rotating on Tiled (tell me if it does now)...


But how are they "hidden"? If you mean they are rendered too early, then just switch the order ;)

I've made successfully sprites (just images) to appear with TIled using the object layer (and that is so much faster than adding them manually).

Link to comment
Share on other sites


  • Recently Browsing   0 members

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