Changeset 67
- Timestamp:
- Jan 8, 2023, 12:29:51 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r64 r67 4 4 5 5 uses 6 XMLConf, Classes, SysUtils, FileUtil, Forms, Controls, Graphics,6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, LCLType, 7 7 Dialogs, ExtCtrls, ComCtrls, Menus, ActnList, UEngine, UPlatform, Math, 8 8 DateUtils, GraphType, UPersistentForm, UApplicationInfo, UTranslator, 9 LCLType, URegistry, UAboutDialog, DOM;9 URegistry, UAboutDialog; 10 10 11 11 type -
trunk/Languages/Tunneler.cs.po
r62 r67 190 190 msgstr "Instrukce" 191 191 192 #: uengine.smetersdug 193 msgid "Meters dug" 194 msgstr "" 195 196 #: uengine.smeterstravelled 197 msgid "Meters travelled" 198 msgstr "" 199 192 200 #: uengine.sorange 193 201 msgid "Orange" 194 202 msgstr "OranÅŸová" 203 204 #: uengine.spercenthit 205 msgid "Percent hit" 206 msgstr "" 195 207 196 208 #: uengine.spink … … 218 230 msgid "Shot fired" 219 231 msgstr "StÅel vystÅeleno" 232 233 #: uengine.sshotshit 234 msgid "Shot hit" 235 msgstr "" 220 236 221 237 #: uengine.sstartgame … … 244 260 msgid "%0:s of %1:s" 245 261 msgstr "%0:s z %1:s" 262 -
trunk/Languages/Tunneler.pot
r62 r67 154 154 msgstr "" 155 155 156 #: uengine.smetersdug 157 msgid "Meters dug" 158 msgstr "" 159 160 #: uengine.smeterstravelled 161 msgid "Meters travelled" 162 msgstr "" 163 156 164 #: uengine.sorange 157 165 msgid "Orange" 158 166 msgstr "" 159 167 168 #: uengine.spercenthit 169 msgid "Percent hit" 170 msgstr "" 171 160 172 #: uengine.spink 161 173 msgid "Pink" … … 180 192 #: uengine.sshotsfired 181 193 msgid "Shot fired" 194 msgstr "" 195 196 #: uengine.sshotshit 197 msgid "Shot hit" 182 198 msgstr "" 183 199 -
trunk/UEngine.pas
r66 r67 16 16 EnergyDecreaseOutside = 0.00003; // ~5 minutes of live 17 17 EnergyIncreaseHome = 0.001; 18 ShieldSteps = 40; 18 ShieldIncreaseHome = 0.001; 19 ShieldDecreaseHit = 0.15; 19 20 ExplosionBulletCount = 100; 20 21 ExplosionRange = 20; … … 60 61 Player: TPlayer; 61 62 Position: TRealPoint; 63 PositionTail: TRealPoint; 62 64 Direction: TRealPoint; 63 65 MaxDistance: Integer; 64 66 Distance: Real; 65 67 StopByDirt: Boolean; 68 CanKill: Boolean; 66 69 constructor Create; 67 70 end; 68 71 72 { TBullets } 73 69 74 TBullets = class(TObjectList<TBullet>) 75 procedure HideAll; 70 76 end; 71 77 … … 129 135 LastShield: Real; 130 136 House: TRectangle; 131 ShootCount: Integer; 137 ShotsCount: Integer; 138 ShotsHit: Integer; 139 MetersDug: Integer; 140 MetersTravelled: Integer; 132 141 procedure ResetTank; 133 142 procedure Init; … … 277 286 SStatistics = 'Statistics'; 278 287 SShotsFired = 'Shot fired'; 288 SShotsHit = 'Shot hit'; 289 SPercentHit = 'Percent hit'; 290 SMetersDug = 'Meters dug'; 291 SMetersTravelled = 'Meters travelled'; 279 292 SWinnerIs = 'The winner is'; 280 293 SGreen = 'Green'; … … 287 300 SGray = 'Gray'; 288 301 302 { TBullets } 303 304 procedure TBullets.HideAll; 305 var 306 I: Integer; 307 begin 308 for I := 0 to Count - 1 do 309 with Items[I] do begin 310 Player.Engine.World.Surface.ItemsXY[Trunc(Position.X), Trunc(Position.Y)] := Byte(miSpace); 311 Player.Engine.World.Surface.ItemsXY[Trunc(PositionTail.X), Trunc(PositionTail.Y)] := Byte(miSpace); 312 end; 313 end; 314 289 315 { TTanks } 290 316 … … 424 450 MaxDistance := -1; 425 451 Distance := 0; 452 CanKill := True; 426 453 end; 427 454 … … 491 518 if (Bullets.Count < MaxBulletCount) and 492 519 ((Now - LastShootTime) > ShootDelay * OneSecond) then begin 493 Inc(Sho otCount);520 Inc(ShotsCount); 494 521 NewBullet := TBullet.Create; 495 522 NewBullet.Player := Self; … … 537 564 Direction := NewDirection; 538 565 Result := True; 566 Inc(MetersDug); 539 567 end; 540 568 end else begin … … 546 574 LastMoveTime := Now; 547 575 Energy := Energy - EnergyDecreaseMove; 576 Inc(MetersTravelled); 548 577 end; 549 578 end; … … 588 617 if House.IsInside(Position) then begin 589 618 if not Exploded then 590 Shield := Shield + 0.2 * 1 / ShieldSteps;619 Shield := Shield + ShieldIncreaseHome; 591 620 if Shield > 1 then Shield := 1; 592 621 end; … … 612 641 P := Trunc(Direction.Y); 613 642 643 PositionTail := Position; 614 644 Position.X := Position.X + Direction.X; 615 645 Position.Y := Position.Y + Direction.Y; … … 641 671 if (Self.Id <> P) and 642 672 (Engine.World.Matters[ItemsXY[Pos.X, Pos.Y]].Kind = mkTankBody) and 643 (Engine.World.Matters[ItemsXY[Pos.X, Pos.Y]].Player = P) then 644 Shield := Shield - 1 / ShieldSteps; 673 (Engine.World.Matters[ItemsXY[Pos.X, Pos.Y]].Player = P) and CanKill then begin 674 Shield := Shield - ShieldDecreaseHit; 675 Inc(Self.ShotsHit); 676 end; 645 677 if StopByDirt then Explosion(LastPos, BulletExplosionRange); 646 678 Bullets.Delete(I); … … 788 820 Position := StartPosition; 789 821 ExplosionPending := False; 822 Bullets.HideAll; 790 823 Bullets.Clear; 791 824 Energy := 1; 792 825 Shield := 1; 793 826 Direction := 0; 794 ShootCount := 0;795 827 ShowTank; 796 828 Exploded := False; … … 804 836 Position := StartPosition; 805 837 PlaceHouse; 838 ShotsCount := 0; 839 ShotsHit := 0; 840 MetersDug := 0; 841 MetersTravelled := 0; 806 842 end; 807 843 … … 824 860 NewBullet.Position.Y := Position.Y; // + NewBullet.Direction.Y * 3; 825 861 NewBullet.MaxDistance := Random(Distance); 862 NewBullet.CanKill := False; 826 863 Bullets.Add(NewBullet); 827 864 end; … … 958 995 StartPosition := Source.StartPosition; 959 996 Score := Source.Score; 960 ShootCount := Source.ShootCount; 997 ShotsCount := Source.ShotsCount; 998 ShotsHit := Source.ShotsHit; 999 MetersDug := Source.MetersDug; 1000 MetersTravelled := Source.MetersTravelled; 961 1001 FExploded := Source.FExploded; 962 1002 Tanks.Assign(Source.Tanks); … … 1535 1575 var 1536 1576 X: Integer; 1577 Y: Integer; 1537 1578 Text: string; 1538 1579 Winner: TPlayer; 1580 I: Integer; 1581 ShotsPercent: Integer; 1582 const 1583 LineHeight = 40; 1539 1584 begin 1540 1585 with Bitmap.Canvas do begin … … 1556 1601 Font.Size := 20; 1557 1602 1558 //Text := SShotsFired + ' ' + IntToStr(ShootCount); 1559 //TextOut(X - TextWidth(Text) div 2, Bitmap.Height div 10, Text); 1560 1603 Y := Bitmap.Height div 10 + 3 * LineHeight; 1604 X := Bitmap.Width div 2 + 50; 1605 Inc(Y, LineHeight); 1606 Text := SShotsFired; 1607 TextOut(X, Y, Text); 1608 Inc(Y, LineHeight); 1609 Text := SShotsHit; 1610 TextOut(X, Y, Text); 1611 Inc(Y, LineHeight); 1612 Text := SPercentHit; 1613 TextOut(X, Y, Text); 1614 Inc(Y, LineHeight); 1615 Inc(Y, LineHeight); 1616 Text := SMetersDug; 1617 TextOut(X, Y, Text); 1618 Inc(Y, LineHeight); 1619 Text := SMetersTravelled; 1620 TextOut(X, Y, Text); 1621 Inc(Y, LineHeight); 1622 1623 for I := 0 to Players.Count - 1 do 1624 with Players[I] do begin 1625 Y := Bitmap.Height div 10 + 3 * LineHeight; 1626 X := Bitmap.Width div 2 + 50 + 500 + 200 * I; 1627 Font.Color := Color1; 1628 Text := Name; 1629 TextOut(X - TextWidth(Text) , Y, Text); 1630 Inc(Y, LineHeight); 1631 Text := IntToStr(ShotsCount); 1632 TextOut(X - TextWidth(Text), Y, Text); 1633 Inc(Y, LineHeight); 1634 Text := IntToStr(ShotsHit); 1635 TextOut(X - TextWidth(Text), Y, Text); 1636 Inc(Y, LineHeight); 1637 if ShotsCount > 0 then 1638 ShotsPercent := Round(ShotsHit / ShotsCount * 100) 1639 else ShotsPercent := 0; 1640 Text := IntToStr(ShotsPercent) + '%'; 1641 TextOut(X - TextWidth(Text), Y, Text); 1642 Inc(Y, LineHeight); 1643 Inc(Y, LineHeight); 1644 Text := IntToStr(MetersDug); 1645 TextOut(X - TextWidth(Text), Y, Text); 1646 Inc(Y, LineHeight); 1647 Text := IntToStr(MetersTravelled); 1648 TextOut(X - TextWidth(Text), Y, Text); 1649 Inc(Y, LineHeight); 1650 end; 1651 1652 Inc(Y, 3 * LineHeight); 1653 1654 X := Bitmap.Width div 2 + 50; 1655 Font.Color := clOrange; 1561 1656 Winner := Players.GetWinner; 1562 1657 if Assigned(Winner) then begin 1563 Text := SWinnerIs + ' ' + Winner.Name; 1564 TextOut(X - TextWidth(Text) div 2, Bitmap.Height div 10 + 60, Text); 1658 Text := SWinnerIs; 1659 TextOut(X, Y, Text); 1660 X := X + TextWidth(Text) + 20; 1661 Font.Color := Winner.Color1; 1662 Text := Winner.Name; 1663 TextOut(X, Y, Text); 1565 1664 end; 1566 1665 end;
Note:
See TracChangeset
for help on using the changeset viewer.