Legacy GM how to make the text disappear 30 seconds after appearing

L

Linda Cell

Guest
Hello GMS, i'm working the first game with GMS 1.4 and i got the trouble with text. As i want the text will appear 30 seconds and then it will disappear, how can i do this? I found some the solution in the google but when i follow it, it just disappear about 2 seconds.
Thank for reading.
 
A

Annoyed Grunt

Guest
Hard to say without posting the code (which you should do), but chances are that the solution found through google has some kind of counter/alarm that handles after how much time the text should disappear. Simply change that from 2 seconds to 30 seconds (remembering that 30 seconds in steps is going to be 30 * room_speed).
 

marasovec

Member
Create event:
Code:
alpha = 0;
show_text = true;
text = "blah blah";
alarm[0] = room_speed * 30; // room_speed is basically 1 second
Alarm 0:
Code:
show_text = false;
Draw event:
Code:
if show_text alpha += 0.01; // appearing
else alpha -= 0.01; // disappearing
alpha = clamp(alpha, 0, 1); // it's not necesary but I like to keep the value between 0 and 1

draw_set_alpha(alpha); // set the alpha for the text
draw_text(x, y, text);
draw_set_alpha(1); // reset the alpha for other objects
 
L

lvls3dx

Guest
Other people already pointed great solutions. Just have in mind that if you don't feel confident using alarms you may also just create some basic timer like:
Code:
if ""wathever condition""{
my_timer = 30;
}

//and the in your step event just put a countdown

if my_timer !=0 {
my_timer = my_timer -1;
}

//and finally add another conditional for when countdown reaches zero

if my_timer =0 {
"""whatever condition"""";
}
 
Top