heyimfrisk
Member
Hey so my text engine thing works fine and all, but I'm having trouble making a sound play every time a letter appears on screen since the time function doesn't stop after the text finishes, could anybody help me figure out how to make it stop when the string is done writing? I tried things to do with string lengths but I had no luck.
Create:
Step:
Create:
GML:
begintext = false
draw_set_font(font0)
txt_num = 1
draw_set_color(c_white)
//this is how long the text can beeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee//
txt[1] = "It's just a useless lamp."
txt[2] = "yamp"
//put txt[3] = "hello" here to add another text.
txt1 = ""
time = 0
exited = true
textx = view_xview[0] + view_wview[0]/35
texty = view_yview[0] + view_hview[0]/1.5
textbox = false
endtextbox = true
textboxopen = false
Step:
GML:
if endtextbox = false{
textboxopen = false
if begintext = true{
if keyboard_check_pressed(ord("X")){
time = time + 100000
}
else{time = time + 2}
if keyboard_check_pressed(ord("Z"))
{
time = 0
txt_num = txt_num + 1
global.textbox = true
txt1 = ""
}
if txt_num < 2{
global.canwalk = false
global.textbox = true
}
if txt_num > 2{
global.canwalk = true
global.textbox = false
textboxopen = false
endtextbox = true
textbox = false
}
else{txt1 = string_copy(txt[txt_num], 0, time/3)}}
if begintext = true{
obj_player.image_index = 0
}
}
Last edited: