Changeset 25 for trunk/UCore.pas
- Timestamp:
- Sep 29, 2011, 6:03:28 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r24 r25 8 8 Dialogs, Classes, SysUtils, Contnrs, Graphics, SpecializedMatrix, SpecializedList, 9 9 IntfGraphics, FPImage, LCLType, SpecializedBitmap, GraphType, Math, URectangle, 10 Syncobjs, UThreading, Forms ;10 Syncobjs, UThreading, Forms, DateUtils; 11 11 12 12 const … … 19 19 ExplosionBulletMinSpeed = 0.2; 20 20 BulletExplosionRange = 3; 21 ShootDelay = 0.2; // seconds 22 ShootEnergyDecrease = 0.01; 21 23 22 24 type … … 67 69 miPlayer8Cannon, miPlayer8Home, miPlayer8TankBody, miPlayer8TankBody2); 68 70 69 TMatterKind = (mkSpace, mkDirt, mkRock, mk Cannon, mkBullet, mkTankBody,71 TMatterKind = (mkSpace, mkDirt, mkRock, mkBullet, mkTankBody, 70 72 mkHome); 71 73 … … 93 95 Tanks: TListObject; // TListObject<TTank> 94 96 Bullets: TListObject; // TListObject<TBullet> 97 LastShootTime: TDateTime; 95 98 Energy: Real; 96 99 LastEnergy: Real; … … 328 331 // Player 1 cannon 329 332 with TMatter(Matter.AddNew(TMatter.Create)) do begin 330 Kind := mk Cannon;333 Kind := mkTankBody; 331 334 Color := clYellow; 332 335 Player := 0; … … 353 356 // Player 2 cannon 354 357 with TMatter(Matter.AddNew(TMatter.Create)) do begin 355 Kind := mk Cannon;358 Kind := mkTankBody; 356 359 Color := clYellow; 357 360 Player := 1; … … 378 381 // Player 3 cannon 379 382 with TMatter(Matter.AddNew(TMatter.Create)) do begin 380 Kind := mk Cannon;383 Kind := mkTankBody; 381 384 Color := clYellow; 382 385 Player := 2; … … 403 406 // Player 4 cannon 404 407 with TMatter(Matter.AddNew(TMatter.Create)) do begin 405 Kind := mk Cannon;408 Kind := mkTankBody; 406 409 Color := clYellow; 407 410 Player := 3; … … 428 431 // Player 5 cannon 429 432 with TMatter(Matter.AddNew(TMatter.Create)) do begin 430 Kind := mk Cannon;433 Kind := mkTankBody; 431 434 Color := clYellow; 432 435 Player := 4; … … 453 456 // Player 6 cannon 454 457 with TMatter(Matter.AddNew(TMatter.Create)) do begin 455 Kind := mk Cannon;458 Kind := mkTankBody; 456 459 Color := clYellow; 457 460 Player := 5; … … 478 481 // Player 7 cannon 479 482 with TMatter(Matter.AddNew(TMatter.Create)) do begin 480 Kind := mk Cannon;483 Kind := mkTankBody; 481 484 Color := clYellow; 482 485 Player := 6; … … 503 506 // Player 8 cannon 504 507 with TMatter(Matter.AddNew(TMatter.Create)) do begin 505 Kind := mk Cannon;508 Kind := mkTankBody; 506 509 Color := clYellow; 507 510 Player := 7; … … 674 677 675 678 if Engine.KeyBoard.KeyState[Ord(Keys.Shoot)] then 676 if Bullets.Count < MaxBulletCount then begin 679 if (Bullets.Count < MaxBulletCount) and 680 ((Now - LastShootTime) > ShootDelay * OneSecond) then begin 677 681 NewBullet := TBullet.Create; 678 682 NewBullet.Player := Self; … … 683 687 NewBullet.StopByDirt := True; 684 688 Bullets.Add(NewBullet); 689 LastShootTime := Now; 690 691 Energy := Energy - ShootEnergyDecrease; 692 if Energy < 0 then Energy := 0; 685 693 end; 686 694 end; … … 763 771 for P := 0 to Engine.Players.Count - 1 do 764 772 with TPlayer(Engine.Players[P]) do 765 if (TMatter(Engine.World.Matter[ItemsXY[Pos.X, Pos.Y]]).Kind = mkTankBody) and 773 if (Id <> P) and 774 (TMatter(Engine.World.Matter[ItemsXY[Pos.X, Pos.Y]]).Kind = mkTankBody) and 766 775 (TMatter(Engine.World.Matter[ItemsXY[Pos.X, Pos.Y]]).Player = P) then 767 776 Shield := Shield - 1 / ShieldSteps;
Note:
See TracChangeset
for help on using the changeset viewer.