Jump to content

Define Game Scaling at Boot


Titus
 Share

Recommended Posts

Hi,

 

Just wondering if it is possible to define the scaling for a game only once in a single state (rather than in every state) and it is applied to all states thereafter? In the game I'm currently making I have a boot state and I want to define the scaling only once in the init function but it doesn't seem to apply to any following states and I have to define these settings on all pages: 

This is the code I'm using for scaling if it helps at all:

	init: function() {		
		this.scale.pageAlignHorizontally = true;	
		this.scale.scaleMode = Phaser.ScaleManager.USER_SCALE;
    	this.scale.setUserScale(0.445, 0.445, 0, 0);

	},

I'm sure I must be missing something obvious. Any help would be appreciated.

Link to comment
Share on other sites

I'm in the same boat. I was going to make a `MobileState` that implements this functionality and extend all my other states from there, but would love to know if there is a singular place in that I can define it.

 

I guess it makes sense that it needs to happen in individual states since any resizing logic would be specific to each state, but for the more generic parts of setting up scale modes, I'd like to put it somewhere a little more singular.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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