jdnichollsc Posted September 2, 2015 Share Posted September 2, 2015 Hi people! What is the correct way to use Phaser.ScaleManager.RESIZE? I want to scale the TilemapLayer when the game size change, but I don’t know how I want to do this: https://runpixierun.tresensa.com/ My demo: http://phaser.azurewebsites.net/runner/ Any help is greatly appreciated sombriks 1 Link to comment Share on other sites More sharing options...
sombriks Posted September 3, 2015 Share Posted September 3, 2015 Hello, it looks like that you want to resize but keep showing the entire planned game content, am i right? You might try to figure some "safezone" strategy arround ScaleManager.SHOW_ALL also take a look at the template projects section in github, there are good samplecodes that if not solve your problem at least will give you a good hint about it: https://github.com/photonstorm/phaser/tree/master/resources/Project%20Templates jdnichollsc 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted September 3, 2015 Author Share Posted September 3, 2015 Thanks for your response my friend, Nop, I want to make a runner game like http://www.goodboydigital.com/runpixierun/ and the canvas have width 100% and height 100% of the window Regards Link to comment Share on other sites More sharing options...
kemz Posted September 3, 2015 Share Posted September 3, 2015 hello, I usually do it this way: var innerWidth = window.innerWidth; var innerHeight = window.innerHeight; var gameRatio = innerWidth/innerHeight; h = 480; w = h*gameRatio; var game = new Phaser.Game(w, h, Phaser.CANVAS,'game'); // width = 100% and height = 100%and then in preload function add: this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;this.scale.pageAlignHorizontally = true;this.scale.pageAlignVertically = true;this.scale.setScreenSize(true);This will scale the game to fit any device screen irrespective of the screen size. jdnichollsc 1 Link to comment Share on other sites More sharing options...
drhayes Posted September 3, 2015 Share Posted September 3, 2015 Poor Nicholls, man. He keeps asking about RESIZE and people keep telling him to use SHOW_ALL. I did it, too! I looked at your demo. What do you want it to do that it's not doing right now? It looks like it's resizing, but kind of jerky? jdnichollsc 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted September 3, 2015 Author Share Posted September 3, 2015 Poor Nicholls, man. He keeps asking about RESIZE and people keep telling him to use SHOW_ALL. I did it, too! I looked at your demo. What do you want it to do that it's not doing right now? It looks like it's resizing, but kind of jerky? hahaha. I want to scale the TilemapLayers and all sprites in the game like RunPixieRun, but not how to do it, I need a guide. In this moment, when you resize the game the flowers size doesn't change :/ ¿What need to do in resize function? Rich ignores me for my bad english hahahaha Regards Link to comment Share on other sites More sharing options...
drhayes Posted September 3, 2015 Share Posted September 3, 2015 I don't know how to do it either. But maybe it involves changing the params on the game's camera? Particularly width, height, and scale? jdnichollsc 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted September 5, 2015 Author Share Posted September 5, 2015 It does not work, Anyone can help us? Regards jdnichollsc 1 Link to comment Share on other sites More sharing options...
jdnichollsc Posted September 5, 2015 Author Share Posted September 5, 2015 hello, I usually do it this way: var innerWidth = window.innerWidth; var innerHeight = window.innerHeight; var gameRatio = innerWidth/innerHeight; h = 480; w = h*gameRatio; var game = new Phaser.Game(w, h, Phaser.CANVAS,'game'); // width = 100% and height = 100%and then in preload function add: this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;this.scale.pageAlignHorizontally = true;this.scale.pageAlignVertically = true;this.scale.setScreenSize(true);This will scale the game to fit any device screen irrespective of the screen size. If you resize the game with this solution you will see blank spaces, I don't like it Thanks for your response! Link to comment Share on other sites More sharing options...
Recommended Posts