Jump to content

game.world.position reseting to 0,0


Noid
 Share

Recommended Posts

I'm experiencing some weird bug when my game loses focus as you can see below: 

4qNZxIr.gif

 

About a second after the game loses focus, game.world.position and game.world.worldPosition become 0,0. Camera position is unaffected. It doesn't happen if I switch to another tab, I can use the developer tools to check the value of game.world.position and see they remain unchainged. It only happens when the game loses focus and the tab is active and visible. 

I've manage to reproduce this bug on chrome and firefox, and using phaser 2.4.4-dev, 2.4.3, 2.4.2 and 2.3.0. 

 

I thought it might be something related to camera.follow() so I've tried not following any sprite and manually setting the camera position somewhere other than 0,0, and I observe the same behavior.

 

It doesn't seem to happen in the examples at phaser.io

 

EDIT: I've managed to find why it happens. I have game.scale.setResizeCallback set to call a function that itself calls resizeWorld() on the tilemap layer. I can workaround the bug by calling resizeWorld() only if game.paused is false. 

Edited by Noid
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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