How do I Center dynamic text on a hud layer

0 favourites
  • 2 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Hi all

    I have a hud layer which of course I do not want to move while the camera then scrolls around my layout.

    However I want messages as text to appear in the centre of the screen on all size devices.

    I have tried to make sense of the mish mash of tutorials and comments on how to do this, but it never seems to work correctly. At the moment I have a HUD layer, and my text object has an anchor behaviours on it.

    I tried then setting this to a position but learn anchors ignore this so when i set X as WindowWidth/2 - Self.TextWidth/2 it does absolutely nothing.

    So how can I guarantee that when this text object contains the string "Welcome" it is centre of the screen, and also when it contains the string "Loriem Ipsum dipsum do" of a different length this is also centered?

    At the moment I have an anchor behaviour added, and hotspots and horizontal align all set to center.

    But its never center when i load it on different screens/browser widths.

    thanks for any guidance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think i have solved it, it was user error.

    My window is 640, but i thought it was 800.

    So with window been 640, i set my text as follows..

    Add anchor object

    Make Horizontal align center.

    Make hotspot center.

    position is 320.

    Hope this helps someone else.

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