pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
authorsheepluva
Sat, 01 Oct 2016 22:48:00 +0200
changeset 11862 cb137eb71556
parent 11861 dea8411974f9
child 11863 38fd32724a61
pimp up random droplet movement vector init to create half-elliptic rather than square patterns - makes using piano less painful to the eyes
hedgewars/uVisualGearsList.pas
--- a/hedgewars/uVisualGearsList.pas	Sat Oct 01 22:35:14 2016 +0200
+++ b/hedgewars/uVisualGearsList.pas	Sat Oct 01 22:48:00 2016 +0200
@@ -230,8 +230,16 @@
                 end;
     vgtDroplet:
                 begin
-                dx:= 0.001 * (random(180) - 90);
-                dy:= -0.001 * (random(160) + 40);
+                // old dx & dy calcs
+                // dx:= 0.001 * (random(180) - 90);
+                // dy:= -0.001 * (random(160) + 40);
+                // => min speed ~ 0.098, max speed ~ 0.218, speed range ~ 0.120
+                // => min angle(4096) ~ 129, max angle ~ 1919, angle range ~ 1790
+                dx:= 0.001 * (98 + random(121)); // speed
+                Frame:= 129 + random(1791); // angle
+                dy:= -dx * hwFloat2Float(AngleSin(Frame));
+                // divide by 2 to create an eliptic shape
+                dx:=  dx * hwFloat2Float(AngleCos(Frame)) / 2;
                 FrameTicks:= 250 + random(1751);
                 Frame:= random(3)
                 end;