gamemaker 从右向左的打字效果 代码教程

分类栏目:gamemaker教程

310

还可以中英文混着哦

创建事件:

image_single=0;
total_text="";
text=""
alarm[0]=3

alarm[0]事件:

alarm[0]=3
if(total_text!=text)
{
    if(string_pos(text,total_text)!=0 or text=="")
    {
        if(ord( string_char_at(total_text,string_length(total_text)-string_length(text)))>128)
        {
            text=string_copy(total_text,string_length(total_text)-string_length(text)-1,string_length(text)+2)
        }
        else
        {
            text=string_copy(total_text,string_length(total_text)-string_length(text),string_length(text)+1)
        }
        exit;
    }
    if(ord( string_char_at(text,1))>128)
    {
        text=string_copy(text,3,string_length(text)-2)
    }
    else
    {
        if(ord( string_char_at(text,1))<128)
        {
            text=string_copy(text,2,string_length(text)-1)
        }
    }
}

alarm[1]事件: total_text="" draw事件:

draw_sprite(sprite_index,image_index,x,y);
fw_draw_text_color(x,y,text,c_red,c_red,1)

使用方法:

total_text="www.zy990.com真是个good东西!!!1"
alarm[1]=120