SHARE
TWEET

turbulence particle step event

a guest Sep 11th, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var vec_x=0;
  2. var vec_y=0;
  3. var that_one=id;
  4.  
  5. var distance_sum=0;
  6.  
  7. with (objWindSource)
  8. {
  9. if (place_meeting(x,y,that_one))
  10.     {
  11.     distance_sum+=power(strength*(radius-point_distance(that_one.x,that_one.y,x,y)),2);    
  12.     }
  13. }
  14.  
  15. with (objWindSource)
  16. {
  17. if (place_meeting(x,y,that_one))
  18.     {
  19.     var len=point_distance(that_one.x,that_one.y,x,y);
  20.     var dir=point_direction(that_one.x,that_one.y,x,y)+polarity*90;
  21.    
  22.     var impact=(len*strength)/1000;
  23.    
  24.     var weight=(power(strength*(radius-len),2)/distance_sum);
  25.    
  26.     vec_x+=lengthdir_x(weight*impact,dir)+random_range(-0.1,0.1);
  27.     vec_y+=lengthdir_y(weight*impact,dir)+random_range(-0.1,0.1);
  28.     }
  29. }
  30.  
  31. hspeed=vec_x;
  32. vspeed=vec_y;
  33.  
  34. image_blend=make_colour_hsv((point_direction(0,0,vec_x,vec_y)/360)*255,255,255);
  35. image_alpha=min(16,point_distance(0,0,vec_x,vec_y))/16;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top