- Timestamp:
- May 18, 2024, 7:39:30 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Engine.pas
r87 r92 112 112 function HideTankProc(Item1, Item2: Byte): Byte; 113 113 function DigProc(Item1, Item2: Byte): Byte; 114 function CheckMinStartPositionDistance: Boolean; 114 115 public 115 116 Name: string; … … 293 294 294 295 uses 295 Platform, FastPixel, UITypes2 ;296 Platform, FastPixel, UITypes2, Geometric; 296 297 297 298 resourcestring … … 747 748 Position.Y := Position.Y + Direction.Y; 748 749 Distance := Distance + Sqrt(Sqr(Direction.X) + Sqr(Direction.Y)); 749 //ShowMessage(FloatToStr(Distance));750 750 if (Distance > MaxDistance) and (MaxDistance >= 0) then begin 751 751 Bullets.Delete(I); … … 917 917 end; 918 918 919 function TPlayer.CheckMinStartPositionDistance: Boolean; 920 var 921 I: Integer; 922 MinDistance: Integer; 923 begin 924 MinDistance := Trunc(Sqrt(Sqr(2 * PlayerHouseSize) + Sqr(2 * PlayerHouseSize))); 925 Result := False; 926 for I := 0 to Engine.Players.Count - 1 do 927 if Engine.Players[I] <> Self then 928 if Distance(Engine.Players[I].StartPosition, StartPosition) < MinDistance then begin 929 Result := True; 930 Break; 931 end; 932 end; 933 919 934 procedure TPlayer.ResetTank; 920 935 begin … … 932 947 933 948 procedure TPlayer.Init; 949 var 950 I: Integer; 934 951 begin 935 952 with Engine do 953 for I := 0 to 100 do begin 936 954 StartPosition := Point(Round(World.Surface.Count.X * 0.2) + Random(Round(World.Surface.Count.X * 0.6)), 937 955 Round(World.Surface.Count.Y * 0.2) + Random(Round(World.Surface.Count.Y * 0.6))); 956 if not CheckMinStartPositionDistance then Break; 957 end; 938 958 Position := StartPosition; 939 959 PlaceHouse; … … 1290 1310 end; 1291 1311 Inc(PByte(PixelRowPtr), BytePerRow * SubPixelSizeY); 1292 1312 end; 1293 1313 end; 1294 1314
Note:
See TracChangeset
for help on using the changeset viewer.