Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- CREATE EVENT
- */
- msg = @"\0Hello guys! \1Jiggy jiggly text!
- \0This is text after a line break, and if you look down
- \1This is more text but jiggly again!
- \0Go down further?
- \2You have ANGRY text!!";
- characters = 0;
- textSpeed = 0.35;
- ss = 0;
- /*
- STEP
- */
- characters += textSpeed;
- /*
- BELOW IS DRAW EVENT
- */
- //We set the offset to 0
- var _xoffset = 0;
- //Y offset for line breaks
- var _yoffset = 0;
- var modifier = 0; //0 by default
- ss++;
- //We loop through the string
- for(var i = 1; i <= string_length(msg) and i <= characters; i++){
- //We get the character at hand
- var _char = string_char_at(msg, i);
- if _char == "\n" { //If we have a line break
- _yoffset += string_height(_char);
- _xoffset = 0;
- } else if _char == @"\"{
- //We have a modifier guys
- //We now need to get the value that is in front of it,
- //and increment i so we can skip it
- //(because we don't want to display neither \ nor the number after it
- modifier = real(string_char_at(msg, ++i));
- } else {
- //We get the WIDTH of the character at hand
- var _w = string_width(_char);
- switch(modifier){ //We draw the character with the offset we have but with modifiers!
- case 0: //Normal
- draw_text(32+_xoffset, 32+_yoffset, _char);
- break;
- case 1: //Jiggly text!!
- draw_text(32+_xoffset+random_range(-1,1), 32+_yoffset+random_range(-1,1), _char);
- break;
- case 2: //Jiggly text!!
- draw_text(32+_xoffset, 32+_yoffset+sin(ss+random(3)/10), _char);
- break;
- default:
- draw_text(32+_xoffset, 32+_yoffset, _char);
- break;
- }
- //We add the width to the offset for the next character
- _xoffset += _w;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement