How do I make paged dialog with sprite font?

0 favourites
  • 3 posts
From the Asset Store
Creepy Sprite Font suitable font for your Dark/Horror/Halloween games.
  • Hello everybody.

    I am trying to make the dialog for my game, and I want to be able to write only one script, for the game to split into many pages of text that the player can read separately... For example:

    "Oh... my god... I think that you ruined it... You are so irresponsible after all... now I'll have to do it by myself."

    The text will be added to the texbox letter by letter (taking into acount that big words break lines), but the text is just too big for the textbox...

    What the player will see: "Oh... my god... I think that you ruined it... You are so"

    I want the player to be able to click Next, and the game will erase all of what is already shown, and keep placing all the other characters...

    Is there a way that I can detect when the textbox is all filled in (to display the next button at the right time, only when there is too much text), and a way to detect what text was shown (to delete it)?

  • You can use SpriteFont.TextHeight and SpriteFont.TextWidth expressions to get the exact size of the text, or calculate length using CharacterWidth, CharacterSpacing, CharacterScale. But this could be tricky if you don't want to break in the middle of a long word.

    So a much easier solution would be to break text manually. Just insert some special character where you want your breaks to be:

    "Oh... my god... I think that you ruined are so irresponsible after I'll have to do it by myself."

    Then use tokenat(text, 0, "@") to print the first part of text, tokenat(text, 1, "@") for second and so on.


    For the typewriter effect search the forum or tutorials, there are plenty of examples. There is also a plugin by Rexrainbow.

    Also, check out this excellent dialog system (working link to capx is in comments):

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you ๐Ÿ’–

    I wasn't really struggling at the typewriter part (I alredy did some fancy dialogs with faces, choices, formatting and sounds hehe ๐Ÿ˜), but at the breaking part.

    And oh... How didn't I think of this before...? It's simple, but clever, thank you. ๐Ÿ˜Š

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