Search the Community
Showing results for tags 'xdk scale undefined'.
-
Hi, I'm new to XDK and Phaser. Recently I started new project in XDK (VERY simple game). After that I replaced all files in /lib/phaser newer version of Phaser v2.4.2. and started emulator. This results in one error Phaser v2.4.2 | Pixi.js v2.2.8 | WebGL | WebAudio | http://phaser.io phaser.js:38516Uncaught TypeError: undefined is not a function Game.js:45Line 45 in Game.js this.scale.setScreenSize(true);Game.js below /* globals Phaser:false */// create BasicGame ClassBasicGame = {};// create Game function in BasicGameBasicGame.Game = function (game) {};// set Game function prototypeBasicGame.Game.prototype = { init: function () { // set up input max pointers //this.input.maxPointers = 1; // set up stage disable visibility change //this.stage.disableVisibilityChange = true; // Set up the scaling method used by the ScaleManager // Valid values for scaleMode are: // * EXACT_FIT // * NO_SCALE // * SHOW_ALL // * RESIZE // See http://docs.phaser.io/Phaser.ScaleManager.html for full document this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; // If you wish to align your game in the middle of the page then you can // set this value to true. It will place a re-calculated margin-left // pixel value onto the canvas element which is updated on orientation / // resizing events. It doesn't care about any other DOM element that may // be on the page, it literally just sets the margin. this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; // Force the orientation in landscape or portrait. // * Set first to true to force landscape. // * Set second to true to force portrait. this.scale.forceOrientation(true, false); // Sets the callback that will be called when the window resize event // occurs, or if set the parent container changes dimensions. Use this // to handle responsive game layout options. Note that the callback will // only be called if the ScaleManager.scaleMode is set to RESIZE. //this.scale.setResizeCallback(this.gameResized, this); // Set screen size automatically based on the scaleMode. This is only // needed if ScaleMode is not set to RESIZE. this.scale.setScreenSize(true); // Re-calculate scale mode and update screen size. This only applies if // ScaleMode is not set to RESIZE. this.scale.refresh(); }, preload: function () { // Here we load the assets required for our preloader (in this case a // background and a loading bar) this.load.image('logo', 'asset/phaser.png'); //this.rect = new Rectangle(0, 0, 5, 4); }, create: function () { // Add logo to the center of the stage this.logo = this.add.sprite( this.world.centerX, // (centerX, centerY) is the center coordination this.world.centerY, 'logo'); // Set the anchor to the center of the sprite this.logo.anchor.setTo(0.5, 0.5); }, gameResized: function (width, height) { // This could be handy if you need to do any extra processing if the // game resizes. A resize could happen if for example swapping // orientation on a device or resizing the browser window. Note that // this callback is only really useful if you use a ScaleMode of RESIZE // and place it inside your main game state. }};I have tried diff approach but without luck:( After comment line 45 everythings works:) Any body can help?