Jump to content

Combining Scaling for multiple devices with the Yeoman generator


Prime8
 Share

Recommended Posts

Hi,

 

I'm using vinod777's cool method of scaling for multiple devices, resolution and screens as detailed in this thread:

 

http://www.html5gamedevs.com/topic/5949-solution-scaling-for-multiple-devicesresolution-and-screens/

 

Because I'm using the yeoman generator, achieving this became a bit more complicated than I would have liked, although I'm sure I've gone around the houses with some of my solutions.

 

vinod777 declares states like this:

game.state.add('Boot', BasicGame.Boot);

Whereas the Yeoman does it like this

game.state.add('boot', require('./states/boot'));

vinod777 is then able to assign variables to BasicGame.

 

As I don't have BasicGame to assign to, I'm using global variables, which does work, but is there a more obvious way of doing this which I'm missing due to my noobishness?

Link to comment
Share on other sites

Hey, I worked it out myself.

 

When I created the game I did

var game = new Phaser.Game( ... )

So in main, I can use 

game.varName

and in States, I use 

this.game.varName

I knew there had to be an easier way

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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