Sign in to follow this  

Sprite Display sort not works

Recommended Posts



I am new in phaser, i tried the following, but not works (i cant change display order)!!


1. variables

var group;

var player;

var player2;


2. function create()

group =;

player = game.add.sprite(400, 350, 'player'); player2 = game.add.sprite(400, 350, 'player');

game.physics.enable(player, Phaser.Physics.ARCADE); game.physics.enable(player2, Phaser.Physics.ARCADE);





3. and at function update() section:

i change sprite x,y coordinates by mouse, or velocity and then:

group.sort('y', Phaser.Group.SORT_ASCENDING);


I want to change the display of sprites (bigger y coordinates, more front like in phaser group examples)... but not works!


I manually change z depth of sprite: player.z=10; but no change.

I have a lot of sprites, how can i change display order, what did i missed?


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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.