Set size of text object to ammount of typed characters

0 favourites
  • 3 posts
From the Asset Store
Retro Weapon Sprites suited for classic style RPG games.
  • on image you see, part of characters are moved to down because size of text object is 250.

    how do i event to resize width to ammount of typed characters?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • From the manual, there is an expression to get the size in pixels of the text.

    [quote:3hijsu88]

    TextWidth

    TextHeight

    Return the size of the actual text content within the text object's rectangle. Note the Text object must be drawn before these have the correct values. If you set the text then immediately access these expressions, they won't yet have the correct value. Adding a Wait 0.1 seconds action will usually solve this.

    You would then set the size of the text object to this amount.

    set text to "my text"

    wait 0.1

    set text object width to expression get text width

  • From the manual, there is an expression to get the size in pixels of the text.

    [quote:3ljppwc6]

    set text to "my text"

    wait 0.1

    set text object width to expression get text width

    works good BUT

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