SHARE
TWEET

Untitled

a guest Aug 12th, 2017 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var i, numrain;
  2. numrain = 25;
  3. for (i = 0; i < numrain; i+=1) {
  4.     var x, y, giveup;
  5.     giveup = 0;
  6.     x = random(view_wview[view_current]);
  7.     y = random(view_hview[view_current]);
  8.     while (collision_line(x,y,x+10,y+10,Obstacle,true,false)) {
  9.         x = random(view_wview[view_current]);
  10.         y = random(view_hview[view_current]);
  11.         giveup += 1;
  12.         if (giveup > 20) { // Prevent infinite loop if all of map collides
  13.             x = -100;
  14.             y = -100;
  15.             break;
  16.         }
  17.     }
  18.     draw_line_width_color(x, y, x+10, y+10, 1, c_aqua, c_aqua);
  19. }
RAW Paste Data
Top