Tuesday, May 25, 2021

【GAMEMAKER】Scroll Text

Information about object: scrollText

Sprite:
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

// insert your own text here
text="insert your own text here,long text,Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id dictum enim. Nunc efficitur dui tellus, ac sollicitudin nisl venenatis in."
length=string_length(text);
set Alarm 0 to 2
Alarm Event for alarm 0:
execute code:

// get the first character
char1=string_copy(text,1,1);
// remove the first character and add it to the end of the text
text=string_copy(text,2,length-1)+char1;
// set the room caption - last argument=size of caption
room_caption=string_copy(text,1,25);
set Alarm 0 to 2

Draw Event:
execute code:


draw_text(0,0, string_copy(text,1,25))

No comments:

Post a Comment