Football Posted July 20, 2014 Share Posted July 20, 2014 Hello I am new in phaser, i tried the following, but not works (i cant change display order)!! 1. variablesvar group;var player;var player2; 2. function create()group = game.add.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);player.add(group);player2.add(group);group.sort(); 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?thanks Link to comment Share on other sites More sharing options...
lewster32 Posted July 20, 2014 Share Posted July 20, 2014 group.add(player);group.add(player2);You need to add the players to the group, not the other way around. I don't think Sprite even has an add function, so your code should've caused an error. Link to comment Share on other sites More sharing options...
Recommended Posts