Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var i, numrain;
- numrain = 25;
- for (i = 0; i < numrain; i+=1) {
- var x, y, giveup;
- giveup = 0;
- x = random(view_wview[view_current]);
- y = random(view_hview[view_current]);
- while (collision_line(x,y,x+10,y+10,Obstacle,true,false)) {
- x = random(view_wview[view_current]);
- y = random(view_hview[view_current]);
- giveup += 1;
- if (giveup > 20) { // Prevent infinite loop if all of map collides
- x = -100;
- y = -100;
- break;
- }
- }
- draw_line_width_color(x, y, x+10, y+10, 1, c_aqua, c_aqua);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement