Advertisement
kateonbush

Untitled

Oct 18th, 2022 (edited)
670
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3. CREATE EVENT
  4.  
  5. */
  6.  
  7. msg = @"\0Hello guys! \1Jiggy jiggly text!
  8.  
  9. \0This is text after a line break, and if you look down
  10.  
  11. \1This is more text but jiggly again!
  12.  
  13. \0Go down further?
  14.  
  15. \2You have ANGRY text!!";
  16.  
  17. characters = 0;
  18. textSpeed = 0.35;
  19. ss = 0;
  20.  
  21.  
  22. /*
  23.  
  24. STEP
  25.  
  26. */
  27.  
  28. characters += textSpeed;
  29.  
  30. /*
  31.  
  32. BELOW IS DRAW EVENT
  33.  
  34. */
  35.  
  36.  
  37. //We set the offset to 0
  38. var _xoffset = 0;
  39.  
  40. //Y offset for line breaks
  41. var _yoffset = 0;
  42.  
  43. var modifier = 0; //0 by default
  44.  
  45. ss++;
  46.  
  47. //We loop through the string
  48. for(var i = 1; i <= string_length(msg) and i <= characters; i++){
  49.  
  50.     //We get the character at hand
  51.     var _char = string_char_at(msg, i);
  52.    
  53.     if _char == "\n" { //If we have a line break
  54.        
  55.         _yoffset += string_height(_char);
  56.         _xoffset = 0;
  57.        
  58.     } else if _char == @"\"{
  59.        
  60.         //We have a modifier guys
  61.         //We now need to get the value that is in front of it,
  62.         //and increment i so we can skip it
  63.         //(because we don't want to display neither \ nor the number after it
  64.        
  65.         modifier = real(string_char_at(msg, ++i));
  66.        
  67.    
  68.     } else {
  69.        
  70.         //We get the WIDTH of the character at hand
  71.         var _w = string_width(_char);
  72.    
  73.         switch(modifier){ //We draw the character with the offset we have but with modifiers!
  74.        
  75.             case 0: //Normal
  76.                 draw_text(32+_xoffset, 32+_yoffset, _char);
  77.                 break;
  78.                
  79.             case 1: //Jiggly text!!
  80.                 draw_text(32+_xoffset+random_range(-1,1), 32+_yoffset+random_range(-1,1), _char);
  81.                 break;
  82.                
  83.             case 2: //Jiggly text!!
  84.                 draw_text(32+_xoffset, 32+_yoffset+sin(ss+random(3)/10), _char);
  85.                 break;
  86.                
  87.             default:
  88.                 draw_text(32+_xoffset, 32+_yoffset, _char);
  89.                 break;
  90.        
  91.         }
  92.    
  93.         //We add the width to the offset for the next character
  94.         _xoffset += _w;
  95.        
  96.     }
  97.    
  98. }
  99.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement