Julia Posted November 5, 2014 Report 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);}, Quote Link to comment Share on other sites More sharing options...
JUL Posted November 6, 2014 Report 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 Quote Link to comment Share on other sites More sharing options...
Julia Posted November 6, 2014 Author Report 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.