Changeset 25
- Timestamp:
- Sep 29, 2011, 6:03:28 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 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; -
trunk/tunneler.lpi
r24 r25 31 31 </local> 32 32 </RunParams> 33 <RequiredPackages Count=" 4">33 <RequiredPackages Count="3"> 34 34 <Item1> 35 35 <PackageName Value="CoolTranslator"/> 36 36 </Item1> 37 37 <Item2> 38 <PackageName Value="LCLBase"/> 39 <MinVersion Major="1" Release="1" Valid="True"/> 38 <PackageName Value="TemplateGenerics"/> 40 39 </Item2> 41 40 <Item3> 42 <PackageName Value=" TemplateGenerics"/>41 <PackageName Value="LCL"/> 43 42 </Item3> 44 <Item4>45 <PackageName Value="LCL"/>46 </Item4>47 43 </RequiredPackages> 48 44 <Units Count="71"> … … 51 47 <IsPartOfProject Value="True"/> 52 48 <UnitName Value="tunneler"/> 53 <EditorIndex Value="7"/>54 49 <WindowIndex Value="0"/> 55 50 <TopLine Value="1"/> 56 51 <CursorPos X="61" Y="10"/> 57 <UsageCount Value="116"/> 58 <Loaded Value="True"/> 52 <UsageCount Value="117"/> 59 53 </Unit0> 60 54 <Unit1> … … 72 66 <IsPartOfProject Value="True"/> 73 67 <UnitName Value="UCore"/> 68 <IsVisibleTab Value="True"/> 74 69 <EditorIndex Value="0"/> 75 70 <WindowIndex Value="0"/> 76 <TopLine Value="7 39"/>77 <CursorPos X=" 14" Y="766"/>78 <UsageCount Value="11 6"/>71 <TopLine Value="756"/> 72 <CursorPos X="22" Y="773"/> 73 <UsageCount Value="117"/> 79 74 <Loaded Value="True"/> 80 75 </Unit2> … … 120 115 <Unit8> 121 116 <Filename Value="../../../lazarus/lcl/include/rasterimage.inc"/> 122 <EditorIndex Value="1"/>123 117 <WindowIndex Value="0"/> 124 118 <TopLine Value="453"/> 125 119 <CursorPos X="1" Y="470"/> 126 120 <UsageCount Value="11"/> 127 <Loaded Value="True"/>128 121 </Unit8> 129 122 <Unit9> … … 144 137 <Unit11> 145 138 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericMatrix.inc"/> 146 <EditorIndex Value="16"/>147 139 <WindowIndex Value="0"/> 148 140 <TopLine Value="152"/> 149 141 <CursorPos X="1" Y="174"/> 150 142 <UsageCount Value="49"/> 151 <Loaded Value="True"/>152 143 </Unit11> 153 144 <Unit12> … … 176 167 <Unit15> 177 168 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericList.inc"/> 178 <EditorIndex Value="2"/>179 169 <WindowIndex Value="0"/> 180 170 <TopLine Value="115"/> 181 171 <CursorPos X="1" Y="132"/> 182 172 <UsageCount Value="27"/> 183 <Loaded Value="True"/>184 173 </Unit15> 185 174 <Unit16> … … 333 322 <Unit36> 334 323 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericBitmap.inc"/> 335 <EditorIndex Value="15"/>336 324 <WindowIndex Value="0"/> 337 325 <TopLine Value="1"/> 338 326 <CursorPos X="20" Y="26"/> 339 327 <UsageCount Value="36"/> 340 <Loaded Value="True"/>341 328 </Unit36> 342 329 <Unit37> 343 330 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Specialized/SpecializedBitmap.pas"/> 344 331 <UnitName Value="SpecializedBitmap"/> 345 <EditorIndex Value="14"/>346 332 <WindowIndex Value="0"/> 347 333 <TopLine Value="47"/> 348 334 <CursorPos X="22" Y="21"/> 349 335 <UsageCount Value="25"/> 350 <Loaded Value="True"/>351 336 </Unit37> 352 337 <Unit38> … … 400 385 <IsPartOfProject Value="True"/> 401 386 <UnitName Value="UPlatform"/> 402 <UsageCount Value="7 5"/>387 <UsageCount Value="76"/> 403 388 </Unit44> 404 389 <Unit45> … … 445 430 <IsPartOfProject Value="True"/> 446 431 <UnitName Value="URectangle"/> 447 <EditorIndex Value="19"/>448 432 <WindowIndex Value="0"/> 449 433 <TopLine Value="120"/> 450 434 <CursorPos X="44" Y="150"/> 451 <UsageCount Value="60"/> 452 <Loaded Value="True"/> 435 <UsageCount Value="61"/> 453 436 </Unit50> 454 437 <Unit51> … … 471 454 <IsPartOfProject Value="True"/> 472 455 <UnitName Value="UPersistentForm"/> 473 <EditorIndex Value="17"/>474 456 <WindowIndex Value="0"/> 475 457 <TopLine Value="69"/> 476 458 <CursorPos X="3" Y="90"/> 477 <UsageCount Value="53"/> 478 <Loaded Value="True"/> 459 <UsageCount Value="54"/> 479 460 </Unit53> 480 461 <Unit54> … … 482 463 <IsPartOfProject Value="True"/> 483 464 <UnitName Value="UApplicationInfo"/> 484 <IsVisibleTab Value="True"/>485 <EditorIndex Value="18"/>486 465 <WindowIndex Value="0"/> 487 466 <TopLine Value="29"/> 488 467 <CursorPos X="20" Y="56"/> 489 <UsageCount Value="53"/> 490 <Loaded Value="True"/> 468 <UsageCount Value="54"/> 491 469 </Unit54> 492 470 <Unit55> … … 494 472 <IsPartOfProject Value="True"/> 495 473 <UnitName Value="URegistry"/> 496 <UsageCount Value="5 2"/>474 <UsageCount Value="53"/> 497 475 </Unit55> 498 476 <Unit56> … … 521 499 <IsPartOfProject Value="True"/> 522 500 <UnitName Value="UThreading"/> 523 <EditorIndex Value="9"/>524 501 <WindowIndex Value="0"/> 525 502 <TopLine Value="34"/> 526 503 <CursorPos X="35" Y="51"/> 527 <UsageCount Value="44"/> 528 <Loaded Value="True"/> 504 <UsageCount Value="45"/> 529 505 </Unit59> 530 506 <Unit60> 531 507 <Filename Value="/usr/share/fpcsrc/2.4.2/packages/fcl-base/src/contnrs.pp"/> 532 508 <UnitName Value="contnrs"/> 533 <EditorIndex Value="8"/>534 509 <WindowIndex Value="0"/> 535 510 <TopLine Value="55"/> 536 511 <CursorPos X="3" Y="72"/> 537 512 <UsageCount Value="21"/> 538 <Loaded Value="True"/>539 513 </Unit60> 540 514 <Unit61> … … 544 518 <ResourceBaseClass Value="Form"/> 545 519 <UnitName Value="UNewGameForm"/> 546 <EditorIndex Value=" 3"/>520 <EditorIndex Value="1"/> 547 521 <WindowIndex Value="0"/> 548 522 <TopLine Value="44"/> 549 523 <CursorPos X="23" Y="65"/> 550 <UsageCount Value="4 4"/>524 <UsageCount Value="45"/> 551 525 <Loaded Value="True"/> 552 526 <LoadedDesigner Value="True"/> … … 559 533 <ResourceBaseClass Value="Form"/> 560 534 <UnitName Value="UMainForm"/> 561 <EditorIndex Value="4"/> 562 <WindowIndex Value="0"/> 563 <TopLine Value="183"/> 564 <CursorPos X="3" Y="206"/> 565 <UsageCount Value="44"/> 535 <WindowIndex Value="0"/> 536 <TopLine Value="184"/> 537 <CursorPos X="76" Y="195"/> 538 <UsageCount Value="45"/> 566 539 <Loaded Value="True"/> 567 540 <LoadedDesigner Value="True"/> … … 574 547 <ResourceBaseClass Value="Form"/> 575 548 <UnitName Value="UMapForm"/> 576 <EditorIndex Value="20"/>577 549 <WindowIndex Value="0"/> 578 550 <TopLine Value="14"/> 579 551 <CursorPos X="19" Y="32"/> 580 <UsageCount Value="44"/> 581 <Loaded Value="True"/> 582 <LoadedDesigner Value="True"/> 552 <UsageCount Value="45"/> 583 553 </Unit63> 584 554 <Unit64> 585 555 <Filename Value="../../PascalClassLibrary/CoolTranslator/ULanguages.pas"/> 586 556 <UnitName Value="ULanguages"/> 587 <EditorIndex Value="6"/>588 557 <WindowIndex Value="0"/> 589 558 <TopLine Value="3"/> 590 559 <CursorPos X="14" Y="20"/> 591 560 <UsageCount Value="21"/> 592 <Loaded Value="True"/>593 561 </Unit64> 594 562 <Unit65> 595 563 <Filename Value="../../PascalClassLibrary/CoolTranslator/UCoolTranslator.pas"/> 596 564 <UnitName Value="UCoolTranslator"/> 597 <EditorIndex Value="5"/>598 565 <WindowIndex Value="0"/> 599 566 <TopLine Value="31"/> 600 567 <CursorPos X="39" Y="33"/> 601 568 <UsageCount Value="21"/> 602 <Loaded Value="True"/>603 569 </Unit65> 604 570 <Unit66> … … 612 578 <Unit67> 613 579 <Filename Value="/usr/share/fpcsrc/2.4.2/rtl/objpas/classes/classesh.inc"/> 614 <EditorIndex Value="10"/>615 580 <WindowIndex Value="0"/> 616 581 <TopLine Value="1508"/> 617 582 <CursorPos X="17" Y="1512"/> 618 583 <UsageCount Value="11"/> 619 <Loaded Value="True"/>620 584 </Unit67> 621 585 <Unit68> 622 586 <Filename Value="/usr/share/fpcsrc/2.4.2/rtl/unix/tthread.inc"/> 623 <EditorIndex Value="11"/>624 587 <WindowIndex Value="0"/> 625 588 <TopLine Value="1"/> 626 589 <CursorPos X="33" Y="15"/> 627 590 <UsageCount Value="11"/> 628 <Loaded Value="True"/>629 591 </Unit68> 630 592 <Unit69> 631 593 <Filename Value="/usr/share/fpcsrc/2.4.2/rtl/inc/threadh.inc"/> 632 <EditorIndex Value="12"/>633 594 <WindowIndex Value="0"/> 634 595 <TopLine Value="50"/> 635 596 <CursorPos X="5" Y="67"/> 636 597 <UsageCount Value="11"/> 637 <Loaded Value="True"/>638 598 </Unit69> 639 599 <Unit70> 640 600 <Filename Value="/usr/share/fpcsrc/2.4.2/rtl/inc/thread.inc"/> 641 <EditorIndex Value="13"/>642 601 <WindowIndex Value="0"/> 643 602 <TopLine Value="164"/> 644 603 <CursorPos X="27" Y="167"/> 645 604 <UsageCount Value="11"/> 646 <Loaded Value="True"/>647 605 </Unit70> 648 606 </Units> 649 <JumpHistory Count="30" HistoryIndex="2 9">607 <JumpHistory Count="30" HistoryIndex="28"> 650 608 <Position1> 651 609 <Filename Value="UCore.pas"/> 652 <Caret Line="126 4" Column="1" TopLine="1240"/>610 <Caret Line="1268" Column="1" TopLine="1240"/> 653 611 </Position1> 654 612 <Position2> 655 613 <Filename Value="UCore.pas"/> 656 <Caret Line=" 1266" Column="1" TopLine="1240"/>614 <Caret Line="803" Column="1" TopLine="786"/> 657 615 </Position2> 658 616 <Position3> 659 617 <Filename Value="UCore.pas"/> 660 <Caret Line=" 1267" Column="1" TopLine="1240"/>618 <Caret Line="805" Column="1" TopLine="786"/> 661 619 </Position3> 662 620 <Position4> 663 621 <Filename Value="UCore.pas"/> 664 <Caret Line=" 1268" Column="1" TopLine="1240"/>622 <Caret Line="806" Column="1" TopLine="786"/> 665 623 </Position4> 666 624 <Position5> 667 625 <Filename Value="UCore.pas"/> 668 <Caret Line="80 3" Column="1" TopLine="786"/>626 <Caret Line="807" Column="1" TopLine="786"/> 669 627 </Position5> 670 628 <Position6> 671 629 <Filename Value="UCore.pas"/> 672 <Caret Line="80 5" Column="1" TopLine="786"/>630 <Caret Line="808" Column="1" TopLine="786"/> 673 631 </Position6> 674 632 <Position7> 675 633 <Filename Value="UCore.pas"/> 676 <Caret Line="80 6" Column="1" TopLine="786"/>634 <Caret Line="809" Column="1" TopLine="786"/> 677 635 </Position7> 678 636 <Position8> 679 637 <Filename Value="UCore.pas"/> 680 <Caret Line="8 07" Column="1" TopLine="786"/>638 <Caret Line="810" Column="1" TopLine="786"/> 681 639 </Position8> 682 640 <Position9> 683 641 <Filename Value="UCore.pas"/> 684 <Caret Line="8 08" Column="1" TopLine="786"/>642 <Caret Line="811" Column="1" TopLine="786"/> 685 643 </Position9> 686 644 <Position10> 687 645 <Filename Value="UCore.pas"/> 688 <Caret Line=" 809" Column="1" TopLine="786"/>646 <Caret Line="789" Column="1" TopLine="783"/> 689 647 </Position10> 690 648 <Position11> 691 649 <Filename Value="UCore.pas"/> 692 <Caret Line=" 810" Column="1" TopLine="786"/>650 <Caret Line="790" Column="1" TopLine="783"/> 693 651 </Position11> 694 652 <Position12> 695 653 <Filename Value="UCore.pas"/> 696 <Caret Line=" 811" Column="1" TopLine="786"/>654 <Caret Line="792" Column="1" TopLine="783"/> 697 655 </Position12> 698 656 <Position13> 699 657 <Filename Value="UCore.pas"/> 700 <Caret Line="7 89" Column="1" TopLine="783"/>658 <Caret Line="791" Column="1" TopLine="783"/> 701 659 </Position13> 702 660 <Position14> 703 661 <Filename Value="UCore.pas"/> 704 <Caret Line="79 0" Column="1" TopLine="783"/>662 <Caret Line="794" Column="1" TopLine="783"/> 705 663 </Position14> 706 664 <Position15> 707 665 <Filename Value="UCore.pas"/> 708 <Caret Line=" 792" Column="1" TopLine="783"/>666 <Caret Line="812" Column="1" TopLine="784"/> 709 667 </Position15> 710 668 <Position16> 711 669 <Filename Value="UCore.pas"/> 712 <Caret Line=" 791" Column="1" TopLine="783"/>670 <Caret Line="1267" Column="1" TopLine="1240"/> 713 671 </Position16> 714 672 <Position17> 715 673 <Filename Value="UCore.pas"/> 716 <Caret Line=" 794" Column="1" TopLine="783"/>674 <Caret Line="1268" Column="1" TopLine="1240"/> 717 675 </Position17> 718 676 <Position18> 719 677 <Filename Value="UCore.pas"/> 720 <Caret Line=" 812" Column="1" TopLine="784"/>678 <Caret Line="1269" Column="1" TopLine="1240"/> 721 679 </Position18> 722 680 <Position19> 723 681 <Filename Value="UCore.pas"/> 724 <Caret Line="126 7" Column="1" TopLine="1240"/>682 <Caret Line="1262" Column="1" TopLine="1240"/> 725 683 </Position19> 726 684 <Position20> 727 685 <Filename Value="UCore.pas"/> 728 <Caret Line="126 8" Column="1" TopLine="1240"/>686 <Caret Line="1264" Column="1" TopLine="1240"/> 729 687 </Position20> 730 688 <Position21> 731 689 <Filename Value="UCore.pas"/> 732 <Caret Line="126 9" Column="1" TopLine="1240"/>690 <Caret Line="1261" Column="42" TopLine="1241"/> 733 691 </Position21> 734 692 <Position22> 735 693 <Filename Value="UCore.pas"/> 736 <Caret Line=" 1262" Column="1" TopLine="1240"/>694 <Caret Line="698" Column="30" TopLine="682"/> 737 695 </Position22> 738 696 <Position23> 739 697 <Filename Value="UCore.pas"/> 740 <Caret Line="1 264" Column="1" TopLine="1240"/>698 <Caret Line="1172" Column="49" TopLine="1159"/> 741 699 </Position23> 742 700 <Position24> 743 701 <Filename Value="UCore.pas"/> 744 <Caret Line="1 261" Column="42" TopLine="1241"/>702 <Caret Line="1326" Column="29" TopLine="1318"/> 745 703 </Position24> 746 704 <Position25> 747 <Filename Value=" ../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericMatrix.inc"/>748 <Caret Line=" 174" Column="1" TopLine="152"/>705 <Filename Value="UCore.pas"/> 706 <Caret Line="69" Column="43" TopLine="51"/> 749 707 </Position25> 750 708 <Position26> 751 709 <Filename Value="UCore.pas"/> 752 <Caret Line="6 98" Column="30" TopLine="682"/>710 <Caret Line="676" Column="14" TopLine="660"/> 753 711 </Position26> 754 712 <Position27> 755 713 <Filename Value="UCore.pas"/> 756 <Caret Line=" 1172" Column="49" TopLine="1159"/>714 <Caret Line="679" Column="52" TopLine="664"/> 757 715 </Position27> 758 716 <Position28> 759 <Filename Value=" ../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericList.inc"/>760 <Caret Line=" 132" Column="1" TopLine="115"/>717 <Filename Value="UCore.pas"/> 718 <Caret Line="21" Column="31" TopLine="1"/> 761 719 </Position28> 762 720 <Position29> 763 <Filename Value=" Forms/UMainForm.pas"/>764 <Caret Line=" 39" Column="35" TopLine="29"/>721 <Filename Value="UCore.pas"/> 722 <Caret Line="679" Column="35" TopLine="663"/> 765 723 </Position29> 766 724 <Position30> 767 725 <Filename Value="UCore.pas"/> 768 <Caret Line=" 1326" Column="29" TopLine="1318"/>726 <Caret Line="21" Column="19" TopLine="86"/> 769 727 </Position30> 770 728 </JumpHistory> 771 729 </ProjectOptions> 772 730 <CompilerOptions> 773 <Version Value=" 10"/>731 <Version Value="9"/> 774 732 <Target> 775 733 <Filename Value="tunneler"/>
Note:
See TracChangeset
for help on using the changeset viewer.