hedgewars/HHHandlers.inc
changeset 80 3c3dc6a148ca
parent 79 29b477319854
child 82 2f4f3236cccc
equal deleted inserted replaced
79:29b477319854 80:3c3dc6a148ca
   222       else else
   222       else else
   223    if (Gear.Message and gm_Down  )<>0 then if Gear.Angle < cMaxAngle then inc(Gear.Angle);
   223    if (Gear.Message and gm_Down  )<>0 then if Gear.Angle < cMaxAngle then inc(Gear.Angle);
   224 
   224 
   225 if ((Gear.State and (gstAttacking or gstMoving or gstFalling)) = 0)and(StepTicks = 0) then
   225 if ((Gear.State and (gstAttacking or gstMoving or gstFalling)) = 0)and(StepTicks = 0) then
   226    begin
   226    begin
   227    if ((Gear.Message and gm_LJump )<>0) then
   227    if ((Gear.Message and gm_LJump ) <> 0) then
   228       begin
   228       begin
   229       Gear.Message:= 0;
   229       Gear.Message:= 0;
   230       if not TestCollisionYwithGear(Gear, -1) then
   230       if not TestCollisionYwithGear(Gear, -1) then
   231          if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 2 else
   231          if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 2 else
   232          if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 1;
   232          if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 1;
   237          Gear.dX:= Sign(Gear.dX) * 0.15;
   237          Gear.dX:= Sign(Gear.dX) * 0.15;
   238          Gear.State:= Gear.State or gstFalling or gstHHJumping;
   238          Gear.State:= Gear.State or gstFalling or gstHHJumping;
   239          exit
   239          exit
   240          end;
   240          end;
   241       end;
   241       end;
   242    if ((Gear.Message and gm_HJump )<>0) then
   242    if ((Gear.Message and gm_HJump ) <> 0) then
   243       begin
   243       begin
   244       Gear.Message:= 0;
   244       Gear.Message:= 0;
   245       if not TestCollisionYwithGear(Gear, -1) then
   245       if not TestCollisionYwithGear(Gear, -1) then
   246          begin
   246          begin
   247          Gear.dY:= -0.20;
   247          Gear.dY:= -0.20;
   248          Gear.dX:= 0.0000001 * Sign(Gear.dX);
   248          Gear.dX:= 0.0000001 * Sign(Gear.dX);
   249          Gear.X:= Gear.X - Sign(Gear.dX)*0.00008; // компенсация сдвига %)
   249          Gear.X:= Gear.X - Sign(Gear.dX)*0.00008; // shift compensation
   250          Gear.State:= Gear.State or gstFalling or gstHHJumping;
   250          Gear.State:= Gear.State or gstFalling or gstHHJumping;
   251          exit
   251          exit
   252          end;
   252          end;
   253       end;
   253       end;
   254    PrevdX:= Sign(Gear.dX);
   254    PrevdX:= Sign(Gear.dX);