You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to get my tilemap to render underneath all of the sprites but it always comes out on top no matter what z-index I set the DisplayGroup to be. Also, once I set stage.displayList = new PIXI.DisplayList(); the tilemap won't render at all.
Here is a code snippet:
// Basic pixi-tilemap example from https://github.com/pixijs/pixi-tilemapvarloader=newPIXI.loaders.Loader();loader.add('atlas','basic/atlas.json');loader.load(function(loader,resources){//third parameter is "true" ONLY IF YOUR TILES ARE SQUARESvartilemap=newPIXI.tilemap.CompositeRectTileLayer(0,[resources['atlas_image'].texture],true);varsize=32;// bah, im too lazy, i just want to specify filenames from atlasfor(vari=0;i<7;i++)for(varj=0;j<7;j++){tilemap.addFrame("grass.png",i*size,j*size);if(i%2==1&&j%2==1)tilemap.addFrame("tough.png",i*size,j*size);}varground=newPIXI.DisplayGroup(0,false)vargroundContainer=newPIXI.Container()groundContainer.displayGroup=groundgroundContainer.addChild(tilemap)stage.addChild(groundContainer)})
Here I even tried adding a tilemap to a container and then adding the container to the stage but it still either
Won't render at all if stage.displayList is set, or
Renders on top of everything if stage.displayList is not set
Any idea as to why this is happening? I'm pretty sure I've followed the examples correctly but of course I could be missing something.
The text was updated successfully, but these errors were encountered:
Thank you so much, I'm glad this was such an easy fix!! Also thank you for putting so much work into PIXI - as I've been learning I've been seeing your name all over the place giving answers and writing helpful modules.
I've been trying to get my tilemap to render underneath all of the sprites but it always comes out on top no matter what z-index I set the DisplayGroup to be. Also, once I set
stage.displayList = new PIXI.DisplayList();
the tilemap won't render at all.Here is a code snippet:
Here I even tried adding a tilemap to a container and then adding the container to the stage but it still either
stage.displayList
is set, orstage.displayList
is not setAny idea as to why this is happening? I'm pretty sure I've followed the examples correctly but of course I could be missing something.
The text was updated successfully, but these errors were encountered: