Jump to content

Game.world.children render issues


Recommended Posts

After realising Phaser.TilemapLayer is rendered individually in Game.world, I thought a good idea in order to have certain Game objects render above the Sprites was to have them inserted using addChildAt on Game.world so that they'd be rendered before the last Layer in the Tilemap.

All Entities/Players in my Game were already handled by a single Phaser.Group so all I had to do was change how I created this Group:

const group = new Phaser.Group(Game);

Game.world.addChildAt(group, (Game.world.children.length - 2));
this._group = group;

And it works. However, there is an issue.

The Phaser.TilemapLayer that is being rendered over the Phaser.Group containing the Phaser.Sprite objects, it has Anti-aliasing applied to it. For example:



Is there anything I'm doing wrong? Thanks.

Link to comment
Share on other sites

I may not fully understand the problem, but tell me if im close. You have a sprite and you want him to appear behind certain layers. For example, a player walking behind a tree. You want him to appear above the grass but behind the tree so there is some level of depth. I went about this in a different manner by doing the following:


        //Add Grass layer

		player = game.add.sprite(800, 400, 'dude');
        game.physics.enable(player, Phaser.Physics.ARCADE);
        player.body.collideWorldBounds = true;

		// add other layers

This makes it so my sprite appears on the appropriate layer and has the depth that i desire. I may have missed your point completely though.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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