Sign in to follow this  
zorocke

Type Writing Effect

Recommended Posts

zorocke    100
I am looking to implement a type writing effect into my game, where the text appears on the screen as if it is being slowly typed.

Has any one done this before and would like to share how they implemented it? I am drawing a string to the screen every frame, so i would need to modify the string as time goes or something.

Share this post


Link to post
Share on other sites
Palidine    1315
Quote:
Original post by zorocke
so i would need to modify the string as time goes or something.


Yep. Have a current string and a goal string. Every time interval, add another letter from goal string to current string. Always only render current string.

-me

Share this post


Link to post
Share on other sites
zorocke    100
: )


if (MainGame.gameTime.TotalGameTime.TotalSeconds - lastCharUpdate > charUpdateInterval)
{
charIndex++;
displayedText = storyText.Substring(0, charIndex);
lastCharUpdate = (float)MainGame.gameTime.TotalGameTime.TotalSeconds;

//This should play text sound
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this