Jump to content

Sprite click doesnt work in fullscreen mode


oddskill
 Share

Recommended Posts

Hello Phaser Community.

 

In the following example http://oddskill.bplaced.net/coding/2dshooter1/index.html the fullscreen

toggle does only work in "not fullscreen" mode.

 

The clicking of the sprite in the lower right corner seems to not trigger its input event

in fullscreen mode, its only possible to use "esc" to leave fullscreen mode.

 

The Other sprite (the bouncing cow) works also in fullscreen mode,

i see no difference in my code regarding both sprites.

 

Can anyone see whats going wrong here?

 

best regards

 

Chris

 

PS: sourcecode below

var game = new Phaser.Game(640, 480, Phaser.CANVAS, 'container', { preload: preload, create: create, update: update });var img;var spriteexplosion;var sound;var fullscreen;var control_bg;function preload() {    game.load.image('cow', './assets/cow.png');  game.load.image('fullscreen', './assets/fullscreen.png');  game.load.image('control_bg', './assets/control_background.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', 500, 500, 1);}function create() {      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');  control_bg = game.add.sprite(0, 400, 'control_bg');  fullscreen = game.add.sprite(564, 409, '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.bounce.set(1);  img.anchor.setTo(0.5, 0.5);  img.inputEnabled = true;  img.input.start(0, true);    img.events.onInputDown.add(select);  control_bg.inputEnabled = true;  control_bg.input.start(0, true);  fullscreen.inputEnabled = true;  fullscreen.input.start(0, true);    fullscreen.events.onInputDown.add(gofullscreen);    game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL;        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() {   console.log('gofullscreen()');    if (game.scale.isFullScreen)    {        console.log('game.scale.isFullScreen');        game.scale.stopFullScreen();    }    else    {   console.log('else');        game.scale.startFullScreen();    }}
Link to comment
Share on other sites

Thanks that works in Chrome.

 

In Firefox 

The Scale mode EXACT_FIT and SHOW_ALL seems to do the same,

and when the aspect ratio is changed by scaling the error still occurs.

 

EDIT

 

That seems to be only a problem with iceweasel and mozilla-build firefox on kali linux which is debian,

on windows in firefox everything is fine so i guess its not a phaser problem.

 

It could be also a graphics driver problem on my laptop, im new to linux especially kali linux.

So i consider my question answered and mark the answer. 

 

best regards

 

Chris 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...