PRSoluções Posted March 29, 2016 Share Posted March 29, 2016 Hi, 1 - On my multiplayer game i need put something in different layers: L1 = tiled map floor L2 = tiled map floor fixed objects L3 = under players effect L4 = game objects L5 = game bullets and bombs L6 = players floor L7 = over players floor L8 = tiled map - third layer with roof 2 - Another problem is that i want that the current player always see their player in front of all other players, like a zindex. Have it on phaser? Thanks. Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted March 29, 2016 Share Posted March 29, 2016 The Phaser has no concept of z-index. Allocated to each layer of a single group and distribute the elements within the group. Link to comment Share on other sites More sharing options...
PRSoluções Posted March 29, 2016 Author Share Posted March 29, 2016 But the group have only parameters: x, y, name It only support sprite, no? Link to comment Share on other sites More sharing options...
Mattia Posted March 29, 2016 Share Posted March 29, 2016 6 hours ago, VitaZheltyakov said: The Phaser has no concept of z-index. Allocated to each layer of a single group and distribute the elements within the group. This. You may want to check this example: http://phaser.io/examples/v2/groups/group-as-layer Also, to have a deeper look at Phaser's groups check this: http://phaser.io/docs/2.4.4/Phaser.Group.html Cheers! Link to comment Share on other sites More sharing options...
drhayes Posted March 29, 2016 Share Posted March 29, 2016 Imagine each group as a piece of paper. Each time you call "game.add.group" you are adding another sheet of paper on to the stack. That means that the last group you add is the top of the stack. If the player is looking down at the stack, that means that the last group you added is the "first" one they see, the one on top. You can then add sprites and images and whatever else into different parts of this stack depending on what they need to be in front of or behind. Here's the list of groups that I'm using in The Big Game: // This is how everything stays ordered so niiiiice. const GROUPS = [ 'sky', 'stars', 'background', 'emitters', 'spikes', 'obstacles', 'switches', 'kiosks', 'objects', 'player', // TODO:0 Consider making "projectiles" group? 'enemies', 'foreground', 'foregroundObjects', 'fog', 'lighting', 'flares', 'glowing', 'dialog', 'menu', 'screenFlash' ]; I store all these groups for later so I can, anywhere in the code, say "game.groups.foreground.add" or "game.groups.spikes.add" and it'll go in the right place. Link to comment Share on other sites More sharing options...
PRSoluções Posted March 29, 2016 Author Share Posted March 29, 2016 Ok, Reading it and the example of phaser, my answer still about groups. Can you add everything on a group? Tilemap, text, ... ? Or only sprite? Thanks. Link to comment Share on other sites More sharing options...
PRSoluções Posted March 29, 2016 Author Share Posted March 29, 2016 No more problem. I read the phaser source code and understand now how it was constructed. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts