Phaser Posted June 27, 2016 Share Posted June 27, 2016 Just a fresh Phaser 2.5 project, ScaleManager.EXACT_FIT and when I use setGameSize to zoom in it works fine and when I use setGameSize to zoom out it works fine... HOWEVER eventually it reaches a point where when you zoom out it starts to off center the entire world so the camera is not following the player... This is inconsistent... what is going on? How to fix? P.S. this isn't just about zooming, I noticed this started to become a problem with multiple 4k monitors. Link to comment Share on other sites More sharing options...
Phaser Posted June 29, 2016 Author Share Posted June 29, 2016 I stripped down my program and put together a sample code to illustrate this inconsistency... perhaps someone can point out the error in my code... press 1 then 2 then 3 then 4.... once you get to 4 you can clearly see the world is no longer centered... <!doctype html> <html> <head> <meta charset="UTF-8" /> <title>hello phaser!</title> <style> body { margin: 0; background: #B4D9E7; position: fixed; width: 100%; height: 100%; } </style> <script type="text/javascript" src="js/phaser.min.js"></script> </head> <body> <script> var game = new Phaser.Game("100", "100", Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render }) function preload() { game.scale.scaleMode = Phaser.ScaleManager.EXACT_FIT; game.world.setBounds(-Infinity, -Infinity, Infinity, Infinity); game.physics.startSystem(Phaser.Physics.P2JS); } var key1, key2, key3, key4; function pressOne() { game.scale.setGameSize( 1280, 720); } function pressTwo() { game.scale.setGameSize( 1920, 1080); } function pressThree() { game.scale.setGameSize( 3840, 2160); } function pressFour() { game.scale.setGameSize( 8000, 8000); } function create() { key1 = game.input.keyboard.addKey(Phaser.Keyboard.ONE); key1.onDown.add(pressOne, this); key2 = game.input.keyboard.addKey(Phaser.Keyboard.TWO); key2.onDown.add(pressTwo, this); key3 = game.input.keyboard.addKey(Phaser.Keyboard.THREE); key3.onDown.add(pressThree, this); key4 = game.input.keyboard.addKey(Phaser.Keyboard.FOUR); key4.onDown.add(pressFour, this); var circle = game.add.graphics(0, 0); circle.beginFill(0xF0C8FF); circle.drawCircle(0, 0, 100); circle.endFill(); circle.x = game.world.centerX; circle.y = game.world.centerY; game.physics.p2.enable(circle, false, false); circle.body.clearShapes(); circle.body.addCircle(100 / 2, 0, 0, 0); circle.body.shapeChanged(); game.camera.follow(circle); } function update() {} function render() {} </script> </body> </html> Link to comment Share on other sites More sharing options...
Phaser Posted July 3, 2016 Author Share Posted July 3, 2016 On 6/29/2016 at 9:28 AM, Phaser said: I do not know how to post this as a bug on github? Link to comment Share on other sites More sharing options...
Phaser Posted July 13, 2016 Author Share Posted July 13, 2016 Still a problem as of 2.6.1. Have no idea how to use github or report problem. Link to comment Share on other sites More sharing options...
drhayes Posted July 13, 2016 Share Posted July 13, 2016 Since you've gone through the trouble of making the tiniest case where it shows the problem it'd be a shame if you didn't post this as a bug. Sign up for GitHub if you don't already have an account. Go here: https://github.com/photonstorm/phaser/issues Click the green "New Issue" button. It will pre-fill the issue description box with some instructions. Put the code that shows the issue in here: https://jsfiddle.net/ You might have to play around a bit to get it to load Phaser correctly. Put the link to your jsfiddle in the bug when describing the problem. Submit the issue! Skeptron 1 Link to comment Share on other sites More sharing options...
Recommended Posts