Jump to content

Swap and swapChildren in group


klg
 Share

Recommended Posts

Hi Everyone, 

 

I'm trying to understand what swap() and swapChildren() methods in group do. Can they be used to swap X and Y positions of children in group?

The example here only seems to swap the Z position. Should I update X and Y position manually or does phaser has a method for that?

 

Thanks

Link to comment
Share on other sites

They swap children on the display list, so yes, z-index only. There's no concept of x or y in a display list, that's a userland level sort really (i.e. do it in your own code). The Group.sort method could help though.

 

Thank Rich. By reading the API, I thought they might swap the X and Y positions too. 

 

Also, thank you so much for the awesome framework and all the support you are providing for it.  :)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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