oddskill Posted July 23, 2014 Share Posted July 23, 2014 Hello Phaser Community. In the following examplehttp://oddskill.bplaced.net/coding/2dshooter1/index.html going fullscreen does not work.In Firebug console i get the error message "Phaser.StageScaleMode is undefined" . what am i doing wrong ? Any help would be appreciated. best regards Chris PS:sourcecode belowvar game = new Phaser.Game(640, 480, Phaser.CANVAS, 'container', { preload: preload, create: create, update: update });var img;var spriteexplosion;var sound;var fullscreen;function preload() { game.load.image('cow', './assets/cow.png'); game.load.image('fullscreen', './assets/fullscreen.png'); game.load.audio('explosionsfx', 'assets/explosion.wav'); game.load.spritesheet('explosiongfx', 'assets/explosion.png', 128, 128, 16); game.load.spritesheet('background', 'assets/parallax100.png', 640, 480, 1);}function create() { game.stage.backgroundColor = '#00ff00'; game.physics.startSystem(Phaser.Physics.ARCADE); game.bg = game.add.tileSprite(0,0,640,400,'background'); game.bg.autoScroll(0,100); img = game.add.sprite(100, 100, 'cow'); fullscreen = game.add.sprite(560, 400, 'fullscreen'); game.physics.enable(img, Phaser.Physics.ARCADE); img.body.collideWorldBounds = true; img.body.bounce.set(0); img.body.velocity.x=100; img.body.velocity.y=100; img.body.collideWorldBounds = true; img.body.bounce.set(0); img.anchor.setTo(0.5, 0.5); img.inputEnabled = true; img.input.start(0, true); img.events.onInputDown.add(select); fullscreen.inputEnabled = true; fullscreen.input.start(0, true); fullscreen.events.onInputDown.add(gofullscreen); //game.world.setBounds(0,0,640,400); game.world.bounds.setTo(0,0,640,400); if (game.camera.bounds) { // The Camera can never be smaller than the game size game.camera.bounds.setTo(0, 0, 640, 480); } game.physics.setBoundsToWorld(); sound = game.add.audio('explosionsfx',1,true);}function update() { }function select(img, pointer) { img.destroy(); sound.play('',0,1,false); spriteexplosion = game.add.sprite(img.x, img.y, 'explosiongfx'); spriteexplosion.anchor.setTo(0.5, 0.5); spriteexplosion.animations.add('explosiongfx_anim'); spriteexplosion.animations.play('explosiongfx_anim', 20, false);}function gofullscreen(spriteexplosion, pointer) { console.log("FULLSCREEN") game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL; //resize your window to see the stage resize too game.stage.scale.setShowAll(); game.stage.scale.refresh(); game.stage.scale.startFullScreen();} Link to comment Share on other sites More sharing options...
oddskill Posted July 23, 2014 Author Share Posted July 23, 2014 Sry and thank you all i found it out myself looking at the phaser examples more closely.The " game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL; "had to be done in the create function. Now it works. Link to comment Share on other sites More sharing options...
Recommended Posts