Jump to content

Phaser / tiled / object layers


doubledragon
 Share

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: 

http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=create+from+objects.js&t=create%20from%20objects

 

 

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.

 

 

post-11614-0-09491200-1418899579_thumb.j

post-11614-0-59622700-1418900556.jpg

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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