Some tweaks to AI
authorunc0rr
Tue, 13 Nov 2012 13:50:04 +0400
changeset 8017 70d386de989f
parent 8016 c1223ef70934
child 8019 b216953c2617
child 8021 095d5ff3d39b
Some tweaks to AI
hedgewars/uAI.pas
--- a/hedgewars/uAI.pas	Sun Nov 11 08:45:51 2012 -0500
+++ b/hedgewars/uAI.pas	Tue Nov 13 13:50:04 2012 +0400
@@ -317,7 +317,14 @@
                 // at final check where we go after jump walking backward
                 if Push(ticks, Actions, AltMe, Me^.Message xor 3) then
                     with Stack.States[Pred(Stack.Count)] do
+                        begin
+                        if Me^.dX.isNegative then
+                            AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0)
+                        else
+                            AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0);
+
                         AddAction(MadeActions, aia_LJump, 0, 305 + random(50), 0, 0);
+                        end;
 
                 // push current position so we proceed from it after checking jump+forward walk opportunities
                 if CanGo then Push(ticks, Actions, Me^, Me^.Message);
@@ -353,6 +360,7 @@
                 addMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere);
 
                 TestAmmos(Actions, Me, ticks shr 12 = oldticks shr 12);
+                
                 end;
                 
             if GoInfo.FallPix >= FallPixForBranching then
@@ -429,7 +437,7 @@
             AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
             end;
 
-        end else
+        end else SDL_Delay(100)
 else
     begin
     BackMe:= PGear(Me)^;