How do I set position to the middle of the cur screen

Get help using Construct 2

Post » Mon Dec 29, 2014 11:18 pm

I've tried everything.

X= WindowWidth/2
Y= WindowHeight/2

X= LayoutWidth/2
Y= LayoutHeight/2

Scrollx
Scrolly


Nothing works. I thought it would be easier to do such an usual thing. Am I missing something? :(

Thanks!
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Tue Dec 30, 2014 12:11 am

I've solved by using the viewport. Here it is in case someone need.

Set position to:
X = abs(ViewportLeft("Interface") +ViewportRight("Interface"))/2
Y = abs(ViewportBottom("Interface") +ViewportTop("Interface"))/2

This will get the current min and max pixels of the screen, sum them and divide by 2 to get the center. Do it for the X and Y axis.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612


Return to How do I....?

Who is online

Users browsing this forum: Huemerson, Lancifer, newt, ultrafop and 12 guests