jazzzar
Member
GM Version: Studio
Target Platform: Windows
Download: see code below
Summary:
Draw text one character at a time
Tutorial:
Hello, this is a script i made to draw your text one character by one,it gives a nice effect for story telling and dialogues, it may not be the best way to do it, but it works, which matters the most :
here is the script :
scr_TextDisplay() :
now in the object that you want it to draw the text put this into create event :
in alarm[0] put this :
Now in the draw event :
Hope this helps you, and saves you some time
EDIT : now you can use # to jump to a new line
REDA.
Target Platform: Windows
Download: see code below
Summary:
Draw text one character at a time
Tutorial:
Hello, this is a script i made to draw your text one character by one,it gives a nice effect for story telling and dialogues, it may not be the best way to do it, but it works, which matters the most :
here is the script :
scr_TextDisplay() :
Code:
str=argument0;//the string to drawxpos=argument1;//the starting x position of the text
xpos=argument1;//the starting x position of the text
ypos=argument2;// the starting y position of the text
cur_width=0;//this is used to see the current width of the "already drawn" characters
len=string_length(str);//the length of the string used to seperate the string into single characters(using an array)
chars[len-1]=0;//the array that holds every single character in the string
line=0;//the line variable determines how much to jump down from the current postion based on the height of the chars
var i,j;//you know what these are :P
for (i=len-1;i>=0;i--)//main loop that seperates the characters and puts them into an array
chars[i]=string_char_at(str,i+1);
draw_text(xpos,ypos,chars[0]);//draw the first character,PS:you can remove this and put it in the next for loop but u need to put chars_drawn to 0 in the create event
cur_width+=string_width(chars[0]);//add the first character's width to the total width
for (j=1;j< chars_drawn;j++)
{
if (chars[j]=='#')
{
line+=string_height(chars[j-1]);
cur_width=0;
}
else
{
draw_text(xpos+cur_width,ypos+line,chars[j]);
cur_width+=string_width(chars[j]);
}
}//the loop that actually draws the characters
Code:
chars_drawn=1;//as i said put this to 0 if you want to draw the first character in the for loop
alarm[0]=10//any value here this is the delay between each character drawn;
Code:
chars_drawn++;
if chars_drawn!=len
alarm[0]=10//the same as above
Code:
scr_TextDisplay("your text goes here",starting x pos,starting y position);
EDIT : now you can use # to jump to a new line
REDA.
Last edited: