Text Parsing Function and Dialog Examples

Show us your completed creations made in Construct 2

Post » Fri Nov 08, 2013 5:40 pm

Since the official sprite font plugin was released, there's a function I've used in almost every project I've worked on that parses a string into individual lines based on a maximum line width, and the character widths of a sprite font object. Basically, the function takes a string, breaks it down into individual lines, and add the lines to an array. I've found the function most useful when implementing dialog systems. Knowing the exact width and height of each line of text allows for much smoother dialog effects. Here are two example:

Dialog at top or bottom of screen
Dialog for specific sprites

Here's a capx with the parsing function used in the above examples:
Capx (Updated to v2 on 12/12/13)

Please note, manually adding newlines to text is not currently supported.

Hopefully someone else finds this function useful as well.zatyka2013-12-12 21:02:36
B
63
S
19
G
8
Posts: 341
Reputation: 12,130

Post » Fri Nov 08, 2013 6:27 pm

Very cool. I'll look into your code in a second!
Image
B
14
S
4
G
2
Posts: 20
Reputation: 2,223

Post » Wed Nov 27, 2013 7:32 pm

Is is possible to post a v146 capx? Thanks!
B
2
Posts: 6
Reputation: 187

Post » Fri Nov 29, 2013 10:35 pm

There's nothing in the capx that uses features beyond v146. You should be able to open the capx using file compression software (e.g. 7-zip) and revert it back to v146.
B
63
S
19
G
8
Posts: 341
Reputation: 12,130

Post » Fri Nov 29, 2013 10:56 pm

That's pretty slick. I'm going to try it in an upcoming project. Thank you for posting.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986


Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 9 guests