Changeset 13
- Timestamp:
- Mar 22, 2011, 5:24:11 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UCore.pas
r12 r13 11 11 const 12 12 MaxBulletCount = 10; 13 EnergySteps = 40; 14 ShieldSteps = 40; 15 ExplosionBulletCount = 200; 16 ExplosionRange = 15; 13 EnergySteps = 400; 14 ShieldSteps = 400; 15 ExplosionBulletCount = 100; 16 ExplosionRange = 20; 17 ExplosionBulletMaxSpeed = 0.5; 18 ExplosionBulletMinSpeed = 0.2; 17 19 18 20 type … … 35 37 Shoot: Word; 36 38 end; 39 40 { TBullet } 37 41 38 42 TBullet = class … … 43 47 Distance: Real; 44 48 StopByDirt: Boolean; 49 constructor Create; 45 50 end; 46 51 … … 163 168 end; 164 169 170 { TBullet } 171 172 constructor TBullet.Create; 173 begin 174 MaxDistance := -1; 175 Distance := 0; 176 end; 177 165 178 { TTank } 166 179 … … 352 365 I: Integer; 353 366 Pos: TPoint; 354 begin 367 D: Real; 368 begin 369 // Check energy 370 if not Engine.IsInsideHouses(Position) then begin 371 Energy := Energy - 1 / EnergySteps; 372 if Energy <= 0 then begin 373 Energy := 0; 374 Explosion; 375 end; 376 end else begin 377 Energy := Energy + 5 * 1 / EnergySteps; 378 if Energy > 1 then Energy := 1; 379 end; 380 if LastEnergy <> Energy then begin 381 LastEnergy := Energy; 382 Engine.Redraw; 383 end; 384 385 // Bullet movement 355 386 for I := Bullets.Count - 1 downto 0 do 356 387 with TBullet(Bullets[I]) do begin … … 362 393 Distance := Distance + Sqrt(Sqr(Direction.X) + Sqr(Direction.Y)); 363 394 //ShowMessage(FloatToStr(Distance)); 364 if (Distance > MaxDistance) and (MaxDistance > 0) then begin395 if (Distance > MaxDistance) and (MaxDistance >= 0) then begin 365 396 Bullets.Delete(I); 397 Engine.Redraw; 366 398 Continue; 367 399 end; … … 369 401 Pos := Point(Trunc(Position.X), Trunc(Position.Y)); 370 402 371 if Engine.World.Surface.ItemsXY[Pos.X, Pos.Y] <> Byte(smNothing) then begin 403 if (Engine.World.Surface.ItemsXY[Pos.X, Pos.Y] <> Byte(smNothing)) and 404 (Engine.World.Surface.ItemsXY[Pos.X, Pos.Y] <> Byte(smBullet)) then begin 372 405 if (Engine.World.Surface.ItemsXY[Pos.X, Pos.Y] = Byte(smDirt1)) or 373 406 (Engine.World.Surface.ItemsXY[Pos.X, Pos.Y] = Byte(smDirt2)) then begin … … 393 426 end; 394 427 Engine.World.Surface.ItemsXY[Pos.X, Pos.Y] := Byte(smBullet); 395 Engine.Redraw;396 end;397 398 if not Engine.IsInsideHouses(Position) then begin399 Energy := Energy - 1 / EnergySteps;400 if Energy <= 0 then begin401 Energy := 0;402 Explosion;403 end;404 end else begin405 Energy := Energy + 5 * 1 / EnergySteps;406 if Energy > 1 then Energy := 1;407 end;408 if LastEnergy <> Energy then begin409 LastEnergy := Energy;410 428 Engine.Redraw; 411 429 end; … … 521 539 NewBullet: TBullet; 522 540 I: Integer; 523 const 524 BulletMaxSpeed = 1; 525 BulletMinSpeed = 0.5; 541 Speed: Real; 542 Angle: Real; 526 543 begin 527 544 if not Exploded then begin … … 531 548 NewBullet := TBullet.Create; 532 549 NewBullet.Player := Self; 533 NewBullet.Direction.X := (BulletMaxSpeed - BulletMinSpeed) * (Random - 0.5); 534 NewBullet.Direction.Y := (BulletMaxSpeed - BulletMinSpeed) * (Random - 0.5); 535 //NewBullet.Direction.X := NewBullet.Direction.X + BulletMinSpeed * Sign(NewBullet.Direction.X); 536 //NewBullet.Direction.Y := NewBullet.Direction.Y + BulletMinSpeed * Sign(NewBullet.Direction.Y); 537 NewBullet.Position.X := Position.X + NewBullet.Direction.X * 2; 538 NewBullet.Position.Y := Position.Y + NewBullet.Direction.Y * 2; 539 (* if NewBullet.Direction.X < (Speed / 10) then 540 NewBullet.Direction.X := Speed / 10; 541 if NewBullet.Direction.Y < (Speed / 10) then 542 NewBullet.Direction.Y := Speed / 10;*) 550 Speed := ExplosionBulletMinSpeed + (ExplosionBulletMaxSpeed - ExplosionBulletMinSpeed) * Random; 551 Angle := Random * 2 * Pi; 552 NewBullet.Direction.X := Sin(Angle) * Speed; 553 NewBullet.Direction.Y := Cos(Angle) * Speed; 554 NewBullet.Position.X := Position.X + NewBullet.Direction.X * 3; 555 NewBullet.Position.Y := Position.Y + NewBullet.Direction.Y * 3; 543 556 NewBullet.MaxDistance := Random(ExplosionRange); 544 557 Bullets.Add(NewBullet); -
trunk/UMainForm.lfm
r11 r13 20 20 Width = 514 21 21 Panels = < 22 item 23 Width = 50 24 end 25 item 26 Width = 50 27 end 28 item 29 Width = 50 30 end 31 item 32 Width = 50 33 end 22 34 item 23 35 Width = 50 -
trunk/UMainForm.pas
r11 r13 77 77 IntToStr(TPlayer(Engine.Players[0]).Direction); 78 78 StatusBar1.Panels[2].Text := FloatToStr(RoundTo(DrawDuration / OneMillisecond, -2)); 79 StatusBar1.Panels[3].Text := IntToStr(TPlayer(Engine.Players[0]).Bullets.Count); 79 80 finally 80 81 Drawing := False; -
trunk/tunneler.lpi
r12 r13 50 50 <TopLine Value="1"/> 51 51 <CursorPos X="15" Y="4"/> 52 <UsageCount Value="7 8"/>52 <UsageCount Value="79"/> 53 53 </Unit0> 54 54 <Unit1> … … 58 58 <ResourceBaseClass Value="Form"/> 59 59 <UnitName Value="UMainForm"/> 60 <EditorIndex Value=" 8"/>61 <WindowIndex Value="0"/> 62 <TopLine Value=" 96"/>63 <CursorPos X=" 6" Y="101"/>64 <UsageCount Value="7 8"/>60 <EditorIndex Value="9"/> 61 <WindowIndex Value="0"/> 62 <TopLine Value="62"/> 63 <CursorPos X="25" Y="78"/> 64 <UsageCount Value="79"/> 65 65 <Loaded Value="True"/> 66 66 <LoadedDesigner Value="True"/> … … 73 73 <EditorIndex Value="0"/> 74 74 <WindowIndex Value="0"/> 75 <TopLine Value=" 518"/>76 <CursorPos X=" 9" Y="535"/>77 <UsageCount Value="7 8"/>75 <TopLine Value="1"/> 76 <CursorPos X="20" Y="14"/> 77 <UsageCount Value="79"/> 78 78 <Loaded Value="True"/> 79 79 </Unit2> … … 104 104 <Unit6> 105 105 <Filename Value="/usr/share/fpcsrc/2.4.0/rtl/objpas/classes/classesh.inc"/> 106 <EditorIndex Value=" 2"/>106 <EditorIndex Value="3"/> 107 107 <WindowIndex Value="0"/> 108 108 <TopLine Value="19"/> 109 109 <CursorPos X="4" Y="36"/> 110 <UsageCount Value="1 1"/>110 <UsageCount Value="12"/> 111 111 <Loaded Value="True"/> 112 112 </Unit6> … … 143 143 <Unit11> 144 144 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericMatrix.inc"/> 145 <EditorIndex Value=" 1"/>146 <WindowIndex Value="0"/> 147 <TopLine Value="15 7"/>148 <CursorPos X=" 44" Y="171"/>149 <UsageCount Value="3 1"/>145 <EditorIndex Value="2"/> 146 <WindowIndex Value="0"/> 147 <TopLine Value="152"/> 148 <CursorPos X="1" Y="158"/> 149 <UsageCount Value="32"/> 150 150 <Loaded Value="True"/> 151 151 </Unit11> … … 265 265 <ResourceBaseClass Value="Form"/> 266 266 <UnitName Value="UMapForm"/> 267 <EditorIndex Value=" 7"/>267 <EditorIndex Value="8"/> 268 268 <WindowIndex Value="0"/> 269 269 <TopLine Value="1"/> 270 270 <CursorPos X="20" Y="39"/> 271 <UsageCount Value="5 7"/>271 <UsageCount Value="58"/> 272 272 <Loaded Value="True"/> 273 273 </Unit27> … … 288 288 <Unit30> 289 289 <Filename Value="/usr/share/fpcsrc/2.4.0/rtl/inc/mathh.inc"/> 290 <WindowIndex Value="0"/> 291 <TopLine Value="63"/> 292 <CursorPos X="14" Y="80"/> 290 <EditorIndex Value="1"/> 291 <WindowIndex Value="0"/> 292 <TopLine Value="58"/> 293 <CursorPos X="14" Y="75"/> 293 294 <UsageCount Value="14"/> 295 <Loaded Value="True"/> 294 296 </Unit30> 295 297 <Unit31> … … 303 305 <Filename Value="../../../lazarus/lcl/intfgraphics.pas"/> 304 306 <UnitName Value="IntfGraphics"/> 305 <EditorIndex Value=" 6"/>307 <EditorIndex Value="7"/> 306 308 <WindowIndex Value="0"/> 307 309 <TopLine Value="3131"/> 308 310 <CursorPos X="42" Y="3148"/> 309 <UsageCount Value="1 4"/>311 <UsageCount Value="15"/> 310 312 <Loaded Value="True"/> 311 313 </Unit32> … … 335 337 <Unit36> 336 338 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericBitmap.inc"/> 337 <EditorIndex Value=" 4"/>339 <EditorIndex Value="5"/> 338 340 <WindowIndex Value="0"/> 339 341 <TopLine Value="25"/> 340 342 <CursorPos X="14" Y="25"/> 341 <UsageCount Value="1 8"/>343 <UsageCount Value="19"/> 342 344 <Loaded Value="True"/> 343 345 </Unit36> … … 400 402 <IsPartOfProject Value="True"/> 401 403 <UnitName Value="UPlatform"/> 402 <UsageCount Value="3 7"/>404 <UsageCount Value="38"/> 403 405 </Unit44> 404 406 <Unit45> … … 428 430 <Unit48> 429 431 <Filename Value="../../../lazarus/lcl/include/custombitmap.inc"/> 430 <EditorIndex Value=" 5"/>432 <EditorIndex Value="6"/> 431 433 <WindowIndex Value="0"/> 432 434 <TopLine Value="330"/> 433 435 <CursorPos X="35" Y="338"/> 434 <UsageCount Value="1 4"/>436 <UsageCount Value="15"/> 435 437 <Loaded Value="True"/> 436 438 </Unit48> … … 447 449 <IsPartOfProject Value="True"/> 448 450 <UnitName Value="URectangle"/> 449 <EditorIndex Value=" 3"/>451 <EditorIndex Value="4"/> 450 452 <WindowIndex Value="0"/> 451 453 <TopLine Value="120"/> 452 454 <CursorPos X="44" Y="150"/> 453 <UsageCount Value="2 2"/>455 <UsageCount Value="23"/> 454 456 <Loaded Value="True"/> 455 457 </Unit50> … … 458 460 <Position1> 459 461 <Filename Value="UCore.pas"/> 460 <Caret Line="3 48" Column="1" TopLine="331"/>462 <Caret Line="375" Column="1" TopLine="354"/> 461 463 </Position1> 462 464 <Position2> 463 465 <Filename Value="UCore.pas"/> 464 <Caret Line="3 49" Column="1" TopLine="331"/>466 <Caret Line="376" Column="1" TopLine="354"/> 465 467 </Position2> 466 468 <Position3> 467 469 <Filename Value="UCore.pas"/> 468 <Caret Line="3 36" Column="35" TopLine="321"/>470 <Caret Line="377" Column="1" TopLine="354"/> 469 471 </Position3> 470 472 <Position4> 471 473 <Filename Value="UCore.pas"/> 472 <Caret Line="3 34" Column="1" TopLine="321"/>474 <Caret Line="379" Column="1" TopLine="354"/> 473 475 </Position4> 474 476 <Position5> 475 477 <Filename Value="UCore.pas"/> 476 <Caret Line="3 35" Column="1" TopLine="321"/>478 <Caret Line="385" Column="1" TopLine="357"/> 477 479 </Position5> 478 480 <Position6> 479 481 <Filename Value="UCore.pas"/> 480 <Caret Line="3 36" Column="1" TopLine="321"/>482 <Caret Line="387" Column="1" TopLine="359"/> 481 483 </Position6> 482 484 <Position7> 483 485 <Filename Value="UCore.pas"/> 484 <Caret Line=" 337" Column="1" TopLine="321"/>486 <Caret Line="403" Column="1" TopLine="386"/> 485 487 </Position7> 486 488 <Position8> 487 489 <Filename Value="UCore.pas"/> 488 <Caret Line=" 338" Column="1" TopLine="321"/>490 <Caret Line="404" Column="1" TopLine="386"/> 489 491 </Position8> 490 492 <Position9> 491 493 <Filename Value="UCore.pas"/> 492 <Caret Line=" 339" Column="1" TopLine="321"/>494 <Caret Line="405" Column="1" TopLine="386"/> 493 495 </Position9> 494 496 <Position10> 495 497 <Filename Value="UCore.pas"/> 496 <Caret Line=" 340" Column="1" TopLine="321"/>498 <Caret Line="410" Column="1" TopLine="386"/> 497 499 </Position10> 498 500 <Position11> 499 501 <Filename Value="UCore.pas"/> 500 <Caret Line=" 343" Column="1" TopLine="321"/>502 <Caret Line="411" Column="1" TopLine="386"/> 501 503 </Position11> 502 504 <Position12> 503 505 <Filename Value="UCore.pas"/> 504 <Caret Line="3 44" Column="1" TopLine="321"/>506 <Caret Line="371" Column="1" TopLine="354"/> 505 507 </Position12> 506 508 <Position13> 507 509 <Filename Value="UCore.pas"/> 508 <Caret Line="3 45" Column="1" TopLine="321"/>510 <Caret Line="372" Column="1" TopLine="354"/> 509 511 </Position13> 510 512 <Position14> 511 513 <Filename Value="UCore.pas"/> 512 <Caret Line="3 46" Column="1" TopLine="321"/>514 <Caret Line="373" Column="1" TopLine="354"/> 513 515 </Position14> 514 516 <Position15> 515 517 <Filename Value="UCore.pas"/> 516 <Caret Line="3 48" Column="1" TopLine="321"/>518 <Caret Line="375" Column="1" TopLine="354"/> 517 519 </Position15> 518 520 <Position16> 519 521 <Filename Value="UCore.pas"/> 520 <Caret Line="3 49" Column="1" TopLine="321"/>522 <Caret Line="376" Column="1" TopLine="354"/> 521 523 </Position16> 522 524 <Position17> 523 525 <Filename Value="UCore.pas"/> 524 <Caret Line="3 50" Column="1" TopLine="322"/>526 <Caret Line="377" Column="1" TopLine="354"/> 525 527 </Position17> 526 528 <Position18> 527 529 <Filename Value="UCore.pas"/> 528 <Caret Line="3 51" Column="39" TopLine="324"/>530 <Caret Line="379" Column="1" TopLine="354"/> 529 531 </Position18> 530 532 <Position19> 531 533 <Filename Value="UCore.pas"/> 532 <Caret Line="3 34" Column="1" TopLine="324"/>534 <Caret Line="385" Column="1" TopLine="357"/> 533 535 </Position19> 534 536 <Position20> 535 537 <Filename Value="UCore.pas"/> 536 <Caret Line="3 78" Column="9" TopLine="364"/>538 <Caret Line="387" Column="1" TopLine="359"/> 537 539 </Position20> 538 540 <Position21> 539 541 <Filename Value="UCore.pas"/> 540 <Caret Line=" 81" Column="20" TopLine="63"/>542 <Caret Line="403" Column="1" TopLine="386"/> 541 543 </Position21> 542 544 <Position22> 543 545 <Filename Value="UCore.pas"/> 544 <Caret Line=" 394" Column="1" TopLine="362"/>546 <Caret Line="404" Column="1" TopLine="386"/> 545 547 </Position22> 546 548 <Position23> 547 549 <Filename Value="UCore.pas"/> 548 <Caret Line="3 49" Column="14" TopLine="332"/>550 <Caret Line="377" Column="10" TopLine="366"/> 549 551 </Position23> 550 552 <Position24> 551 553 <Filename Value="UCore.pas"/> 552 <Caret Line=" 741" Column="27" TopLine="735"/>554 <Caret Line="175" Column="9" TopLine="158"/> 553 555 </Position24> 554 556 <Position25> 555 557 <Filename Value="UCore.pas"/> 556 <Caret Line="5 14" Column="32" TopLine="504"/>558 <Caret Line="555" Column="3" TopLine="537"/> 557 559 </Position25> 558 560 <Position26> 559 <Filename Value=" UCore.pas"/>560 <Caret Line=" 344" Column="18" TopLine="328"/>561 <Filename Value="../../PascalClassLibrary/Generics/TemplateGenerics/Generic/GenericMatrix.inc"/> 562 <Caret Line="158" Column="1" TopLine="152"/> 561 563 </Position26> 562 564 <Position27> 563 565 <Filename Value="UCore.pas"/> 564 <Caret Line="37 6" Column="22" TopLine="360"/>566 <Caret Line="374" Column="12" TopLine="363"/> 565 567 </Position27> 566 568 <Position28> 567 569 <Filename Value="UCore.pas"/> 568 <Caret Line="5 28" Column="31" TopLine="518"/>570 <Caret Line="545" Column="6" TopLine="536"/> 569 571 </Position28> 570 572 <Position29> 571 573 <Filename Value="UCore.pas"/> 572 <Caret Line="5 30" Column="26" TopLine="518"/>574 <Caret Line="565" Column="106" TopLine="561"/> 573 575 </Position29> 574 576 <Position30> 575 577 <Filename Value="UCore.pas"/> 576 <Caret Line=" 15" Column="27" TopLine="1"/>578 <Caret Line="521" Column="3" TopLine="519"/> 577 579 </Position30> 578 580 </JumpHistory>
Note:
See TracChangeset
for help on using the changeset viewer.