hedgewars/uAIAmmoTests.pas
changeset 7620 fa3bc79dc0b8
parent 7501 1763dc3bc9b7
child 7671 43f38923bc6e
equal deleted inserted replaced
7619:e5d17bab312f 7620:fa3bc79dc0b8
   610 
   610 
   611 x:= hwFloat2Float(Me^.X);
   611 x:= hwFloat2Float(Me^.X);
   612 y:= hwFloat2Float(Me^.Y);
   612 y:= hwFloat2Float(Me^.Y);
   613 
   613 
   614 if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then
   614 if Abs(trunc(x) - Targ.X) + Abs(trunc(y) - Targ.Y) < 40 then
   615     begin
       
   616     TestDesertEagle:= BadTurn;
       
   617     exit(BadTurn);
   615     exit(BadTurn);
   618     end;
       
   619 
   616 
   620 t:= 2 / sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y));
   617 t:= 2 / sqrt(sqr(Targ.X - x)+sqr(Targ.Y-y));
   621 Vx:= (Targ.X - x) * t;
   618 Vx:= (Targ.X - x) * t;
   622 Vy:= (Targ.Y - y) * t;
   619 Vy:= (Targ.Y - y) * t;
   623 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);
   620 ap.Angle:= DxDy2AttackAnglef(Vx, -Vy);