[solved] Breaking Text or Sprite font into smaller objects

0 favourites
  • 3 posts
From the Asset Store
Horror Halloween Pixel Art Sprite Font Space Data included
  • Is there a way to make a Text object or Sprite font object break/split/explode into smaller ones?

    IE. "This is only a test." - one object into -> "This" "is" "only" "a" "test." - 5 separate objects with space between them.

    I've made it like that

    using simple loop and tokenat, to count and get words from a variable and then place them on the layout.

    But I'm having issues and can't figure out a good way to wrap the words that do not fit horizontally to next line.

    Event 7 - shown on the image is one of my latest tests, but it still doesn't work correctly all the times.

    As to the subject question. I could have just one text (or sprite font) object on the layout with correct size and word wrapping selected. Then I could only break that entire text into each words at runtime and it's done.

    Any help appreciated.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This code works:

    Note, that if you are using C2 runtime, you will need to wait 1 tick before accessing "textWidth" expression.

  • I see my mistakes. Thank You!

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