Time Between Texts

P

PrinceOfBelgium

Guest
Hey, I’m relatively new to GMS and I was wondering how to make a time in between two texts that appear onscreen.

Example:
“Hello, there!”
(Wait three seconds)
“Welcome to this test!”

I understand I would probably need to use alarms, but I’m not sure how.
 
you will need an object to keep track of the text. and display them when ready
create event
Code:
text[0]="Hello, there!"; // first line of text
text[1]="Welcome to this test!"; // second line of text
totalLines=2; // how many total lines of text to show
delay=room_speed*3; // how long to wait between each line
textIndex=0; // what line of text are we currently showing
alarm[0]=delay; // set alarm to go off in (delay) amount of time
alarm 0 event
Code:
if(textIndex<totalLines) { // if our current line is less than our total number of lines
  textIndex++; // go to the next line
  alarm[0]=delay; // and set the alarm to go off again
}
draw event
Code:
draw_text(10,10,text[textIndex]); // draw the current line of text
 
P

PrinceOfBelgium

Guest
Thank you so much! The code worked flawlessly. So grateful for these forums.
 
Top