Jump to content

How World Works ?


Recommended Posts

Hello !

How world works in Phaser ? The elements of the world are in an array and the objects inside the camera are taken from the array and rendered ?

Is the world divided in 'chunks' and some parts are rendered ?

Thanks a lot.



Link to comment
Share on other sites


Phaser has a stage (game.stage), on that stage it has created a group called "__world" and a shorcut is created to that group called game.world.

The stage is a scene graph, everything added to it will have a .visible property, this determines whether it is rendered or not.  Children of the stage members will not be rendered if the parent stage member has .visible==false.

World is a child of stage and as it was the first thing added to the stage it can also be accessed longhand by game.stage.children[0]

The world group is where phaser adds new members using game.add.xxx, where xxx is image, sprite etc.

You don't have to keep new members in world, phaser keeps it's debug image directly on the stage after world!

hope that helps

Link to comment
Share on other sites

Sorry, I don't understand.

Something will automatically render itself if it's visible property is set to true, ie

    thing.visible = true;

to hide it do

    thing.visible = false;

newly created images, sprites etc are set visible=true by default.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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