I like this condition for home run better
authornemo
Tue, 16 Oct 2012 22:57:48 -0400
changeset 7763 6ab7307fcec3
parent 7762 d2fd8040534f
child 7764 28613382e3f3
I like this condition for home run better
hedgewars/uGearsHedgehog.pas
--- a/hedgewars/uGearsHedgehog.pas	Tue Oct 16 22:35:01 2012 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Tue Oct 16 22:57:48 2012 -0400
@@ -968,12 +968,12 @@
         if (CurrentHedgehog^.Gear = Gear) then
             isCursorVisible:= false
     end;
-// IMO this should trigger homerun based on leftX/rightX + someval instead - that is 'knocking it out of the park'
 if (not isZero(Gear^.dY)) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then
     begin
     inc(Gear^.FlightTime);
-    if Gear^.FlightTime = 3000 then
+    if (Gear^.FlightTime > 1500) and ((hwRound(Gear^.X) < leftX-250) or (hwRound(Gear^.X) > rightX+250))  then
         begin
+        Gear^.FlightTime:= 0;
         AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage);
         PlaySound(sndHomerun)
         end;