Jump to content

texturepacker not working with phaser.min.js


Finders_Keepers
 Share

Recommended Posts

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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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