Search the Community
Showing results for tags 'setgamesize'.
Found 2 results
Hi All, I am working on my first game in phaser and running into a lot of issues currently two of them are bugging me the most. 1) Game resizing : The project demands for the game to go full screen on devices and resize on desktops, I am setting the scaleMode to EXACT_FIT and resizing as follows this.game.scale.setGameSize(window.innerWidth, window.innerHeight); var groupScaleX = (window.innerWidth) / (this.gameContainer.origWidth); var groupScaleY = (window.innerHeight) / (this.gameContainer.origHeight); this.scaleFactor = groupScaleX < groupScaleY ? groupScaleX : groupScaleY; this.gameContainer.scale.setTo(this.scaleFactor); this.gameContainer.origWidth/origHeight is set to the background image dimensions 1920X1280. Above piece of code works fine on chrome but on FF and safari, the game actually flicker when we try to resize the browser. Also found this issue in another game that was quoted somewhere as a reference : http://www.goodboydigital.com/runpixierun/. Try to resize the browser with game running the screen flickers even for chrome browser. 2) Also the game on some devices is rendering very poorly and looks like every thing is being Pixelated on the screen which includes all the graphics and text content. As suggested by someone on the forum to pixel align the content as a resolution I have tried that as well, it seems as if the trick works well on chrome but the same issue still persists on other browsers. recalling resize function once again after say ~50ms delay seems to be working currently for me. But I assume that is no good coding practice and there has to be some better workaround for this.
Hey everybody, many, many posts in this forum have already helped me a lot in getting to know Phaser, so I decided to take a chance in asking a question I didn't find an answer to yet. Thanks to a topic on this forum (http://www.html5gamedevs.com/topic/17437-changing-game-size-dynamically/?hl=%2Bchange+%2Bworld+%2Bsize) I found out that I can dynamically change the world size of my game. When trying, I realized that it reduces the size by cutting off of the right side and/or the bottom (and respectively increases the size by adding to the right side and/or the bottom). The thing I want to do is reducing the game size by cutting off from the right and left side equally, so the center of the game will always be in the exact center of the world. So instead of cutting of the whole from only one side, I'd like to cut off half of the whole from each side. If it's not understandable, what I mean, please just ask and I'll try to explain better.