Finders_Keepers Posted March 30, 2017 Share Posted March 30, 2017 Hello, I tried to run my JSONArray texture pack using the default phaser.min.js and texturepacker and upon adding an image to a state. it threw an error saying cannot set size of null/ undefined. I checked and double checked the code. There were no problems with it. So i changed the engine to phaser-arcade-physics.min.js and this time it worked. The problem now seems to be that it doesn't recognize the function this.scale.setScreenSize(true) inside the BOOT.js file. Which worked in phaser.min.js. I can see the phaser-arcade-physics.min.js is the updated file of the two. But which version of phaser.min should be used with the final game? Also which version of phaser is compatible with both texture atlas and scale.setScreenSize? Also if i manually change the code of phaser-arcade-physics.min.js to recognize scale.setScreenSize(true) how should i go about it? TT Link to comment Share on other sites More sharing options...
Finders_Keepers Posted March 31, 2017 Author Share Posted March 31, 2017 Okay everyone here's the solution; I was using some old piece of phaser.min.js that's not supporting the documentations. But docs aren't really clear about the function scale.setScreenSize(true) state right now. Fact is, it's been deprecated for a while now. And i learned that there is a few other functions to replace it like this.scale.updateLayout(); and this.scale.refresh() Link to comment Share on other sites More sharing options...
Finders_Keepers Posted March 31, 2017 Author Share Posted March 31, 2017 So i'm running the game on phaser.min.js 2.4 and above and this one is working. But i noticed that the canvas wasn't aligning as it used to with scale.setScreenSize. So i went digging and figured that the canvas needs to communicate directly with the HTML index files. When i was declaring my game before it was var game = new Phaser.Game(960, 640, Phaser.AUTO, 'gameContainer');. gameContainer being the div id. So in order to place the canvas correctly it is important for Phaser.ScaleManager to scale it directly w/o the div Now it is var game = new Phaser.Game(960, 640, Phaser.AUTO, null); Link to comment Share on other sites More sharing options...
Finders_Keepers Posted March 31, 2017 Author Share Posted March 31, 2017 Hope it was useful to y'all. And as always, Stay Awesome Link to comment Share on other sites More sharing options...
Recommended Posts