Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // On create event
- creator = id;
- mover_speed = random_range(4, 7);
- distance = 100;
- place = 0;
- x_offset = 20;
- y_offset = 10;
- x_start = 320;
- y_start = 270;
- randomizer_y = 0;
- randomizer_x = 0;
- sequence = false;
- counter = 0;
- // Step event
- // Do the same move for 4 steps to seem more smooth
- counter++;
- if (counter > 4) {
- randomizer_y = random_range(0, 2);
- randomizer_x = random_range(0, 2);
- counter = 0;
- }
- // y jittering
- if (randomizer_y < 1) {
- y_offset -= 2;
- } else {
- y_offset += 2;
- }
- if (y_offset > 20) {
- y_offset = 20;
- }
- if (y_offset < 0) {
- y_offset = 0;
- }
- // x jittering
- if (randomizer_x < 1) {
- x_offset -= 1;
- } else {
- x_offset += 1;
- }
- if (x_offset > 40) {
- x_offset = 40;
- }
- if (x_offset < 0) {
- x_offset = 0;
- }
- x = x_start + x_offset + lengthdir_x(distance, place);
- y = y_start + y_offset + lengthdir_y(distance, place);
- place += mover_speed;
Advertisement
Add Comment
Please, Sign In to add comment