How do I create a Text field?

  • Hi everyone,

    it might be a dumb question but I would like to create a Text field of a certain Width and Height.

    The Object TextBox does not exist anymore in Construct 3.

    Then, within the text field, I would like to have the text wrap automatically when a sentence is longer than the width of the field.

    The text is coming from a Json file and can be translated in different languages.

    I ask this question because first, I can't have a defined size for the text field as it scales in width and height simultaneously.

    So I had an idea.Maybe, if I have an instance variable that will count each character and if a line of the sentence reaches this variable, it will automatically create a new line to continue the sentence.

    I don't know how to do it and it feels tricky and hard to manage, don't you feel?

    Do you have an easier solution?

    Here is an image of what I try to achieve (the green text field, so the text fits in it)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Object TextBox does not exist anymore in Construct 3.

    Do you need Text object or Text Input object? Both exist in C3.

    For Text you can set object width and wrapping in properties, and the text will automatically wrap to a new line.

    If you need to adjust the size of the green sprite to the text size, see this demo:

    dropbox.com/s/f789oo50lr7bvy7/SpeechBubble.capx

  • dop2000

    Thank you Dop2000, I'll take a look at your example.

    I just needed Text object.

    Cheers

  • dop2000

    This is a great example. Thank you.

    Omg, it seems also that I had a Construct 3 bugs with the Text object.

    I was not able to change the size of the text object without scaling the height and the width at the same time.

    After closing and reopen Construct, I was finally able to change the height without affecting the width :)

    Also, thank you for your time, definitely, your example will probably help me for another thing I wanted to do with text scripting :)

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