Automatic background for dynamically created text

  • Hi!

    I'm developing an RPG and the dialogue texts vary greatly in length. Has anyone a suggestion of a good way of automatically assigning a background color for dynamically created text objects? My problem seems to be that I need to wait something like 0.1 seconds after creating the text object before Construct will calculate it's size correctly (for sizing the background rectangle accordingly). This slight delay gives the game a glitchy feel. It would be great if we simply had a text-background property, but in the absence of that how would you create text backgrounds for dynamic text?

  • Actually you only need to wait 1 tick for Construct 2 to know the correct size.

    What you could do is display the text off screen, get the measurements and only when you have them display the text on screen with your fitting background. 1 tick delay normally should not be very noticable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you, this seems to work! And I learned about Wait 0, which seems very useful!

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