How do I center an object no matter what is the apsect ratio

Get help using Construct 2

Post » Sun May 03, 2015 9:47 am

hello
I am working with different aspect ratios (using scale outer) and would like that an object would be in the center of the screen no matter what is the apsect ratio of the screen
B
8
S
2
Posts: 130
Reputation: 970

Post » Tue May 05, 2015 10:23 am

x center = ((ViewportRight("layer") - ViewportLeft("layer")) / 2)
Y center = ((ViewportBottom("layer") - ViewportTop("layer")) / 2)

Should work on any scaling settings.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Tue May 05, 2015 11:32 am

great, thanks! and also for your other answer :)
B
8
S
2
Posts: 130
Reputation: 970


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests