Making animated text

Use this forum to help develop your game-making skills, and get feedback on writing, art, music, or anything else you've created that isn't attached to a game in progress.
Locked
Message
Author
User avatar
Kurten
Newbie
Posts: 7
Joined: Thu Dec 23, 2010 10:56 am
Projects: Yume
Location: Sweden
Contact:

Making animated text

#1 Post by Kurten » Tue Apr 05, 2011 3:51 pm

Hello folks!

Unsure if this is the right section, feel free to move it if that is not the case ^_^

I have been thinking about something. You know the text in many visual novels appear animated? Like the computer is typing the message to you as you watch it. First, one letter pops up, then the next, and next, and next. I have been trying to figure out how to do this in my own visual novel engine that im currently building, but with no luck. Therefore i thought i'd ask you guys. You work with visual novels all the time, so do you mind sharing some of that wisdom? :D
Animated text isn't critically necessary for my own build, but it would be a nice feature to implement =)

//Kurten

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Making animated text

#2 Post by PyTom » Tue Apr 05, 2011 4:50 pm

What's the problem you're having? The way Ren'Py does it is to:

1) Break the text up into lines.
2) Based the on the time the text has been shown for, decide how many character to show. Call this n.
3) For each line:
3a) Draw the first n characters of the line, or the whole line if n is greater than the line length.
3b) Subtract the line length from n.
3c) Break if n <= 0.
4) Repeat steps 2-4 until all text is shown.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Kurten
Newbie
Posts: 7
Joined: Thu Dec 23, 2010 10:56 am
Projects: Yume
Location: Sweden
Contact:

Re: Making animated text

#3 Post by Kurten » Wed Apr 06, 2011 3:10 pm

Awesome, just the answer i was looking for! ^_^ Thx PyTom! :D
I will try to build something similar in my engine! ^_^

Locked

Who is online

Users browsing this forum: No registered users