• Advertisement
Sign in to follow this  

Type Writing Effect

This topic is 2692 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
: )


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
Sign in to follow this  

  • Advertisement