This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

I'm making a 2D game. I don't know how to set Popup position on screen center.
I search some tuturial on youtube but it is for portrait layout.
How to setup popup menu on the screen center for landscape layout.
Thanks you so much

in Engine by (29 points)

2 Answers

+3 votes

Not sure what's your issue here. There is a function for that:

by (10,634 points)
0 votes

Firstly, you'll need to set the pivot offset to 40 and 40 so it appears in the middle of the popup, this is vital as the overall position of the popup is connected to the popup, because of this offest the popup will require to have a position of (-40, -40) so that the offset position is (0, 0)
Because the center of the viewport is located at (512x, 300y) then the position of the popup will be 472x (or 512 - 40) and 260y (or 300 - 40).
Now the popup should be located in the center of the viewport.

by (309 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.