ItsYaBoiWesley Posted May 27, 2019 Share Posted May 27, 2019 Hey guys. I'm using CreateJS to make my javascript game. According to the documentation, objects are layered one on top of the other, in order of their addition to the stage. To control layering, I push to multiple "layer" arrays, and add the objects from those layers. However, it isn't working! Objects that are created first are the ones on the bottom, not objects that are added first. Here's my adding code, as you can see it adds in order of the arrays. for(let a = 0; a < blockLayer.length; a++) { stage.addChild(blockLayer[a]) } for(let b = 0; b < floorLayer.length; b++) { stage.addChild(floorLayer[b]) } for(let c = 0; c < entityLayer.length; c++) { stage.addChild(entityLayer[c]) } for(let d = 0; d < lightLayer.length; d++) { stage.addChild(lightLayer[d]) } for(let e = 0; e < uiLayer.length; e++) { stage.addChild(uiLayer[e]) } stage.update(); blockLayer = floorLayer = entityLayer = lightLayer = uiLayer = []; Anyone with experience in CreateJS? Help would be really appreciated! Quote Link to comment Share on other sites More sharing options...
ItsYaBoiWesley Posted May 27, 2019 Author Share Posted May 27, 2019 Nevermind, the problem was in the last line. Instead of clearing all the arrays, it somehow combined them! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.