Yeah, I know, there is so much typewrite codes around...
But I wanted to share my own version with you!
I made it by looking at pyrometal's code and when I understood how
it works, I built my own, shorter version.
- Speak is variable where function stores the line.
- type is variable that is used to store characters into
text actor.
- counter is variable that holds the amount of
characters printed.
The code:
- Code: Select all
char Speak[200] = " "; //Create variables
char type[200] = " ";
int counter;
void message(char Line[200]) //Create function
{
int i; //Create integer called i
int limit = strlen(Line); //Create integer called limit and make it equal to string length of "Line"
for (i = 0; i <= 199; i ++) //Reset strings and counter
{
Speak[i] = NULL;
type[i] = NULL;
counter = 0;
}
for (i = 0; i < limit; i ++) //Store "Line" to "Speak"
{
Speak[i] = Line[i];
}
}
Add this code to text actors draw actor event:
- Code: Select all
if (counter < strlen(Speak))
{
type[counter] = Speak[counter]; //Store "Speak" characters to "type" one by one
sprintf(text, type); //Print "type"
counter ++; //Increase counter
}
Sorry for that there's no comments in the zip file. =P
I want to thank pyrometal for sharing codes of his typewriter engine. It helped me alot. =) Also thanks to DST and Bee-Ant for sending me their typewriter engines. =)
Tell me what you think!
EDIT: Added little thing that turns written text backwards...