phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
http://phaser.io
MIT License
1.35k stars 491 forks source link

What's the difference between 'world' and 'stage'? #565

Closed windschaser closed 6 years ago

windschaser commented 6 years ago

This Issue is about the difference between world and stage. I found that game.world.add(sprite) differs from game.stage.add(sprite)--------the 2nd method will not show the sprite on screen, So, what's the difference? I'm confused……

samme commented 6 years ago

Stage is the root display container. World is the root Group and the first child of the Stage.

Both methods should display the sprite, unless the sprite is offscreen or covered by another object. Only World objects are affected by the camera position.

Use the game.add.* methods.