ManBoy

Group Depth Sorting not working?

Recommended Posts

var layerFg = game.add.group();layerFg.z = 1;layerFg.create(0,0,'Atlas','Player.png');var layerBg = game.add.group();layerBg.create(0,0,'Atlas','Background.jpg');layerBg.z = 0;
var layerFg = game.add.group();layerFg.z = 1;var fg = new Phaser.Sprite(game,0,0,'Atlas','Player.png');layerFg.add(fg);layerBg = game.add.group();layerBg.z = 0;var bg = new Phaser.Sprite(game,0,0,'Atlas','Background.jpg');layerBg.add(bg);

I tried both codes, none are working. Btw I am still using 1.16

Share this post


Link to post
Share on other sites

Create bg group first. No need to use z property in such case.

 

Or use your code but add something like this after all (maybe you will need to replace world for actual parent group)

world.sort("z");

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.