Guest User

Untitled

a guest
Aug 31st, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. // On create event
  2. creator = id;
  3. mover_speed = random_range(4, 7);
  4. distance = 100;
  5. place = 0;
  6. x_offset = 20;
  7. y_offset = 10;
  8. x_start = 320;
  9. y_start = 270;
  10. randomizer_y = 0;
  11. randomizer_x = 0;
  12. sequence = false;
  13. counter = 0;
  14.  
  15.  
  16. // Step event
  17. // Do the same move for 4 steps to seem more smooth
  18. counter++;
  19. if (counter > 4) {
  20. randomizer_y = random_range(0, 2);
  21. randomizer_x = random_range(0, 2);
  22.  
  23. counter = 0;
  24. }
  25.  
  26. // y jittering
  27. if (randomizer_y < 1) {
  28. y_offset -= 2;
  29. } else {
  30. y_offset += 2;
  31. }
  32.  
  33. if (y_offset > 20) {
  34. y_offset = 20;
  35. }
  36.  
  37. if (y_offset < 0) {
  38. y_offset = 0;
  39. }
  40.  
  41. // x jittering
  42. if (randomizer_x < 1) {
  43. x_offset -= 1;
  44. } else {
  45. x_offset += 1;
  46. }
  47.  
  48. if (x_offset > 40) {
  49. x_offset = 40;
  50. }
  51.  
  52. if (x_offset < 0) {
  53. x_offset = 0;
  54. }
  55.  
  56.  
  57. x = x_start + x_offset + lengthdir_x(distance, place);
  58. y = y_start + y_offset + lengthdir_y(distance, place);
  59.  
  60. place += mover_speed;
Advertisement
Add Comment
Please, Sign In to add comment