Sign in to follow this  

Define Game Scaling at Boot

Recommended Posts



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.

Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.