How do I put text on screen when the screen has scrolled?

Get help using Construct 2

Post » Fri Jan 20, 2017 10:58 am

Hi,

Just wondering if it's possible to have an overlay eg: text PLAYER 2 turn on the centre of the screen even when the player has moved and has scroll to.

Currently at the start of the game PLAYER 1 comes up in the middle of the screen, great as the game starts always in the same place.
But when player 1 has platform attached and moves along the platform, when PLAYER 2 text comes up, it's way back at the start of the level.

How can I centre text no matter where the player has moved to?

Thanks for any help.
B
10
S
3
Posts: 55
Reputation: 802

Post » Fri Jan 20, 2017 11:08 am

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jan 20, 2017 11:11 am

You can use a global layer for the UI to prevent it from scrolling or you can just use CanvasToLayerX() to change on-screen coordinates to coordinates in a layer.
Something like:
CanvasToLayerX(0, WindowWidth/2, WindowHeight/2)
Should get you X for middle of the screen.
B
17
S
6
G
1
Posts: 41
Reputation: 1,725

Post » Fri Jan 20, 2017 3:36 pm

Thanks guys,

I did google and search before but because I didn't know how to describe it, I came up empty.

I tried CanvasToLayerX(0, WindowWidth/2, WindowHeight/2) but that produced it in the wrong place.
But I used that code to search and found the best way for me was ScrollX, ScrollY

Thanks, if it wasn't for your advice I wouldn't have found that answer.
Thank you.
B
10
S
3
Posts: 55
Reputation: 802


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, JackTYGA, Kin, neverk, worm1 and 31 guests