Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

How to dynamically resize the game and sprites depending on the resolution of the mobile device


Ryuuke
 Share

Recommended Posts

Short answer is, yes.

 

Long one:

 

You must use Phaser scale methods, and also: Phaser.Device - see Rich post http://www.html5gamedevs.com/topic/2990-a-framework-approach-to-multi-screen-full-screen-development/?hl=device

 

And check this topics since there is my answer to the game scaling thing:

 

http://www.html5gamedevs.com/topic/1941-scale-to-fit-the-screen/?hl=%2Bscale+%2Bdisplay#entry13298

 

And check the search for adddtiional info cases about: display, game , scale:

 

http://www.html5gamedevs.com/index.php?app=core&module=search&do=search&fromMainBar=1

Link to comment
Share on other sites

Hi, 

 

I tried these two codes On iphone, and samsung galaxy S, the result is the same, and the game has not been resized.

this is part of my Boot class

create() {        this.stage.scale.pageAlignHorizontally = true;        this.input.maxPointers = 1;        this.stage.disableVisibilityChange = true;        if (!this.game.device.desktop) {            this.game.stage.scale.startFullScreen();            this.game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;            this.game.stage.scale.minWidth = 480;            this.game.stage.scale.minHeight = 260;            this.game.stage.scale.maxWidth = 1024;            this.game.stage.scale.maxHeight = 768;            this.game.stage.scale.forceLandscape = true;            this.game.stage.scale.setScreenSize(true);            this.game.stage.scale.setShowAll();            this.game.stage.scale.refresh();        }        this.game.state.start("Preloader");    }

and 

create() {        this.stage.scale.pageAlignHorizontally = true;        this.input.maxPointers = 1;        this.stage.disableVisibilityChange = true;        if (!this.game.device.desktop) {        }        this.game.state.start("Preloader");    }

I started the game with 480 320, this take a full screen on iphone, but 1/3 of the screen of samsung

 

EDIT 1: 

 

seems like cocoon js problem, it's strange, i tried it with cordova and it works like a charm, but i can't use it for game.

Do you know any other platform for build mobile html5 games?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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