RPG Dialogues???

Get help using Construct 2

Post » Tue Dec 10, 2013 2:19 pm

I am really new to Construct 2 (and making games in general) so there are tons of things I have no clue about. Recently I've been surfing the net a lot in the hopes of finding a tutorial that would teach me how to make dialogues like those you could find in every single RPG game. But of course, no luck so far. The kind of dialogue I'm trying to make is something like this:

1). It has a typewriter effect (where letters will appear one by one perhaps every 0.5 seconds).
2). In the middle of the "typewriter effect", if the spacebar is pressed then the whole text will be displayed (therefore ignoring the effect).
3). When the full text is already displayed, pressing the spacebar AGAIN will cause the next set of text to appear.

Could somebody give me a hand on this one? It would be really helpful!
Thanks!
B
4
Posts: 3
Reputation: 231

Post » Tue Dec 10, 2013 3:32 pm

Every developer goes through a process in which they must disconnect from how a process functions on the surface, and learn how to break a processes into technical components. It's the difference between knowing that text appears one character at a time, and knowing that the text object is set to display the left X number of characters in a string, where X equals the number of character already displayed in the text object + 1. Once you understand the technical building blocks, you can pretty much create anything you want. In my opinion, the fastest way to learn the building blocks available is to play around with C2, follow some tutorials, and make some practice games.

I don't want to sound too preachy, so here are a few tips to accomplish your goal:
  • When going for a typewriting effect, display one character at a time by utilizing the "left" and "len" system expressions to determine how much of a string to display as text. There are other methods, but I believe this is the simplest method to comprehend.
  • Create a state machine of the text display process. One method is to have a "state" variable. For example, State 1 can be when text is being draw. State 2 can be when the maximum number of characters are displayed, and the game is waiting for the player to press space. If in state 1, display the text character by character. When the maximum allowable characters is reached, or no more characters can be displayed, go to state 2. Also, if the player presses space while in the 1st state, automatically fill the text with the maximum number of characters, and go to state 2. If the player presses space while in state 2, go back to state 1 to display the next line of characters, or, if there is no more characters, remove all text. This is a simplified example, but it should give you an idea of how it could work.
  • I would highly recommend using the spritefont object instead of the text object to display text if possible. When using spritefonts, you know the exact width and height of each character. This allows for much more sophisticated dialog systems.
  • Assuming you use the spritefont object, take a look at the function I posted here. It takes a string, and breaks it out into individual lines, which is very useful for dialog systems.

Best of luck!
B
64
S
19
G
8
Posts: 341
Reputation: 12,185

Post » Tue Dec 10, 2013 6:00 pm

Wow, thanks a lot @zatyka!!!

That really clears up everything. Thank you for all those additional tips too! Very much appreciated!
B
4
Posts: 3
Reputation: 231


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests