Julia Posted November 5, 2014 Share Posted November 5, 2014 Hey, I'm figuring out how to set a pause screen on my vertical platformer game. Everything is working fine, except I don't know how to position the pause screen in the current viewport and not at the complete top of the game. The game itself is 5000px high and the viewport is 600px. I've tried different things, but so far without success. My pause function, which is now positioned at 0, 0 managePause: function () {game.paused = true;var graphics = game.add.graphics(0, 0);graphics.beginFill(000000, 0.5);graphics.drawRect(0, 0, 1200, 600);var vowText = this.add.text(600, 300, vow1, fontStyle);vowText.anchor.setTo(0.5, 0.5);this.input.onDown.add(function() {vowText.destroy();graphics.destroy();game.paused = false;}, this);}, Link to comment Share on other sites More sharing options...
JUL Posted November 6, 2014 Share Posted November 6, 2014 try thatgraphics.x = game.world.width/2-graphics.width/2;graphics.y = game.world.height/2-graphics.height/2;graphics.fixedToCamera=true; not tested Link to comment Share on other sites More sharing options...
Julia Posted November 6, 2014 Author Share Posted November 6, 2014 Thanks for your answer! I already guessed it had something to do with the camera. I only had to use graphics.fixedToCamera = true! I positioned the elements just at 0, 0. Link to comment Share on other sites More sharing options...
Recommended Posts