Automatic background for dynamically created text

Get help using Construct 2

Post » Thu Sep 10, 2015 7:39 pm

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?
B
9
S
1
Posts: 97
Reputation: 715

Post » Thu Sep 10, 2015 7:53 pm

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.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sat Sep 12, 2015 10:31 am

Thank you, this seems to work! And I learned about Wait 0, which seems very useful!
B
9
S
1
Posts: 97
Reputation: 715


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], ShinjiDammit and 3 guests