This forum is read only and just serves as an archive. If you have any questions, please post them on

8 years ago by msn

I have layers and entities in my game. I want that my one entity set first and then the last layer. So that last layer is on the top of everything. I have increased and decreased zIndex of entity but its not working for me. Any help will be highly appreciated.

8 years ago by quidmonkey

I'm guessing you read through the documentation for zIndex. For layer's simply draw them in the order you want in your game's draw method:
draw: function(){
    this.parent(); //draw entities
    this.layer1.draw(); //draw first layer on top of entities
    this.layer2.draw(); //draw second layer on top of first and entities
    this.layer3.draw(); //draw final layer

If you want things drawn differently, simply change the order.

8 years ago by jizaymes

There is also some methodology in this post as well.
Page 1 of 1
« first « previous next › last »