Search the Community
Showing results for tags 'game.stage'.
-
Hello guys, I have been a long-time lurker on this forum. Most of my time spent here I wasn't even logged in but I have always enjoyed a ton of great answers here and even more interesting questions asked. Anyways, I don't want to waste your time with introducing myself and will allow myself to ask a question for the first time! I am confused by the usage of "this." vs. "this.game". It seems that I can use both interchangeably without any errors popping up in the console and the same results on the screen. Here is an example: var MyGame = {}; MyGame.game = new Phaser.Game(800, 600, Phaser.AUTO, ''); MyGame.Boot = function() {}; MyGame.Boot.prototype = { preload: function() {}, create: function() { this.game.stage.backgroundColor = '#FFFFFF'; this.game.physics.startSystem(Phaser.Physics.ARCADE); this.state.start('Preload'); }, update: function() {} }; The three lines in the "create" method can all be written beginning with "this.game" or just "this." For example: this.game.stage.backgroundColor = '#FFFFFF'; this.stage.backgroundColor = '#FFFFFF'; this.game.physics.startSystem(Phaser.Physics.ARCADE); this.physics.startSystem(Phaser.Physics.ARCADE); this.game.state.start('Preload'); this.state.start('Preload'); They work just fine in both ways. How come that is so? When do I use "this.game" and when only "this."? I have been following along these tutorials which is also where I got the above code snippets from: SpaceHipster Tutorial: https://gamedevacademy.org/html5-phaser-tutorial-spacehipster-a-space-exploration-game/ BunnyDefender YT Series: link
- 7 replies
-
- stage
- game.stage
- (and 4 more)
-
Hello, I come from an AS3 Background and have started working with panda.js. So far I am getting used to it, but i do have a question for understanding. What is the difference between: Game.Scene.Container vs Game.Scene.Stage vs Game.Scene.World? I have worked with nape before, so the world is for physics i take it. But where does scene.container and scene.stage differ from eachother? Thanks, N3RD_L1F3
- 2 replies
-
- game.scene
- game.stage
-
(and 2 more)
Tagged with: