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

0 favourites
  • 4 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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.

  • https://www.google.be/?hl=nl#hl=nl&q=sc ... scirra.com

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)