Search the Community
Showing results for tags 'project template'.
-
Hi all. I am wondering why there is such extensive usage of the "this" keyword in the "Full Screen Mobile" project template (included with Phaser, I am using v2.4.4). Code sample from 'Full Screen Mobile' project template: BasicGame.Boot.prototype = { init: function () { this.input.maxPointers = 1; this.stage.disableVisibilityChange = true; this.stage.backgroundColor = '#000000'; if (this.game.device.desktop) { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.setMinMax(160, 240, 640, 960); this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; } else { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.setMinMax(160, 240, 640, 960); this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; this.scale.forceOrientation(true, false); this.scale.setResizeCallback(this.gameResized, this); this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this); this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this); } }Code sample from phaser.io 'examples': var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });function preload() { game.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');}var s;function create() { s = game.add.sprite(game.world.centerX, game.world.centerY, 'bot'); s.anchor.setTo(0.5, 0.5); s.scale.setTo(2, 2); s.animations.add('run'); s.animations.play('run', 10, true);}What difference does this make? Why do I have to use it? Is it considered 'best practice'? Does it affect anything if I don't include it?
- 3 replies
-
- this
- project template
-
(and 5 more)
Tagged with:
-
Hey Everyone, I created a Phaser starter project template for Visual Studio 2013 that uses JavaScript. You can view more here: https://github.com/funzeye/Phaser-Project-Template-Javascript https://visualstudiogallery.msdn.microsoft.com/e6eeccc4-3963-4e3d-8181-77d94ae67d9a TypeScript Version also Available: https://visualstudiogallery.msdn.microsoft.com/a4f5464e-897a-48c2-85e4-7ac2b1d92d0f
-
- Phaser
- visual studio
-
(and 4 more)
Tagged with: