Jerkoco Posted August 15, 2016 Share Posted August 15, 2016 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 More sharing options...
Jerkoco Posted August 16, 2016 Author Share Posted August 16, 2016 up Link to comment Share on other sites More sharing options...
stupot Posted August 16, 2016 Share Posted August 16, 2016 Hi, 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 More sharing options...
Jerkoco Posted August 17, 2016 Author Share Posted August 17, 2016 Thank you. In fact, I'm making an game framework (canvas) and I want to know: How phaser change the property to visible ? How he know if he must move and render an object ? Thanks. Link to comment Share on other sites More sharing options...
Jerkoco Posted August 17, 2016 Author Share Posted August 17, 2016 up Link to comment Share on other sites More sharing options...
Jerkoco Posted August 18, 2016 Author Share Posted August 18, 2016 UP Link to comment Share on other sites More sharing options...
Jerkoco Posted August 18, 2016 Author Share Posted August 18, 2016 UP Link to comment Share on other sites More sharing options...
stupot Posted August 18, 2016 Share Posted August 18, 2016 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 More sharing options...
Recommended Posts