Jump to content

Best way to resize for mobile


Recommended Posts

Hello there.

I'm making a simple game to understand phaser better. I have made a simple game using this resolution:


phaserGame = new Phaser.Game(480, 720, Phaser.AUTO, '');


So, i can center this on screen etc. However, if i wish the game to be resized to fit the screen in desktop and mobile devices, what would be the best way to do ?


Thanks again for any attention

Link to comment
Share on other sites

Well, the most easy solution is to let Phaser auto-scale it to use as much screen space as possible, by adding the following to your gamestate's preload function:

this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVertically = true;

You can always read up on the Phaser ScaleManager documentation, experiment with other scaleMode constants and find which suits your needs most.

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.

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.


  • Recently Browsing   0 members

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