- Timestamp:
- 2016-01-16 14:34:34 (7 years ago)
- Location:
- 2015/koodauskerho/AakeR/IMBT
- Files:
-
- 7 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/koodauskerho/AakeR/IMBT/IMBT/IMBT/IMBT.cs
r7096 r7110 15 15 public bool telaJaljetLimit; 16 16 public bool voiLiikkua = true; 17 public double vahinkoKerroin = 1; 17 18 18 19 public Pelaaja(double leveys, double korkeus, Image pelaajanKuva, Image tykkiTorninKuva, Image rajahdysKuva, Image liekkiKuva) … … 49 50 ((IMBT)Game.Instance).AddCollisionHandler(this, "perusAmmus", delegate (PhysicsObject a, PhysicsObject b) 50 51 { 51 this.healthit.Value -= 3.5 ;52 this.healthit.Value -= 3.5* vahinkoKerroin; 52 53 SavuLiekki(); 53 54 }); 54 55 ((IMBT)Game.Instance).AddCollisionHandler(this, "raketti", delegate (PhysicsObject a, PhysicsObject b) 55 56 { 56 this.healthit.Value -= 12 ;57 this.healthit.Value -= 12* vahinkoKerroin; 57 58 SavuLiekki(); 58 59 }); 59 60 ((IMBT)Game.Instance).AddCollisionHandler(this, "pallo", delegate (PhysicsObject a, PhysicsObject b) 60 61 { 61 this.healthit.Value -= 18 ;62 this.healthit.Value -= 18* vahinkoKerroin; 62 63 SavuLiekki(); 63 64 }); 64 65 ((IMBT)Game.Instance).AddCollisionHandler(this, "rajahdys", delegate (PhysicsObject a, PhysicsObject b) 65 66 { 66 this.healthit.Value -= 1000 ;67 this.healthit.Value -= 1000* vahinkoKerroin; 67 68 SavuLiekki(); 68 69 }); 69 70 ((IMBT)Game.Instance).AddCollisionHandler(this, "laser", delegate (PhysicsObject a, PhysicsObject b) 70 71 { 71 this.healthit.Value -= 6; 72 this.healthit.Value -= 2.5*vahinkoKerroin; 73 SavuLiekki(); 74 }); 75 ((IMBT)Game.Instance).AddCollisionHandler(this, "haulikko", delegate (PhysicsObject a, PhysicsObject b) 76 { 77 this.healthit.Value -= 2.5 * vahinkoKerroin; 72 78 SavuLiekki(); 73 79 }); … … 193 199 Image laser3Kuva = LoadImage("LaserAnimaatio3"); 194 200 Image laser4Kuva = LoadImage("LaserAnimaatio4"); 195 Image suojaKilpi = LoadImage("Suojakilpi");196 Image suojaKilpiTykki = LoadImage("TykkiSuojakilpi");197 Image haulikkoAmmus = LoadImage("haulikkoAmmus");201 Image suojaKilpiKuva = LoadImage("Suojakilpi"); 202 Image suojaKilpiTykkiKuva = LoadImage("TykkiSuojaKilpi"); 203 Image haulikkoAmmusKuva = LoadImage("haulikkoAmmus"); 198 204 public Image liekkiKuva = LoadImage("Liekki"); 199 205 SoundEffect ammusAani = LoadSoundEffect("AmmusÄäni"); … … 203 209 SoundEffect laserAani = LoadSoundEffect("LaserAani"); 204 210 SoundEffect laserAmmusAani = LoadSoundEffect("LaserAmmusAani"); 211 SoundEffect shieldAani = LoadSoundEffect("ShieldAani2"); 205 212 Pelaaja pelaaja1; 206 213 MultiSelectWindow alkuValikko; … … 269 276 { 270 277 int valinta = RandomGen.NextInt(pelaaja1Koneet.Length); 278 //int valinta = 2; 271 279 272 280 Pelaaja pelaaja = new Pelaaja(leveys * 0.8, korkeus * 0.8, pelaajienKoneet[pelaajanr - 1][valinta], pelaajienTykit[pelaajanr - 1][valinta], rajahdysKuva, liekkiKuva); … … 433 441 break; 434 442 case "raketti": 435 raketinAani.Play(); 436 ammus.Image = rakettiKuva; 437 ammus.Tag = "raketti"; 438 ammus.Size *= 2.5; 439 AddCollisionHandler(ammus, delegate (PhysicsObject a, PhysicsObject b) 443 if (konenr != 2) 440 444 { 441 a.Destroy(); 442 Explosion rajahdys = new Explosion(140); 443 rajahdys.Position = a.Position; 444 rajahdys.ShockwaveReachesObject += RajahdysOsuu; 445 Add(rajahdys); 446 raketinAani.Stop(); 447 }); 448 pelaaja.Ase.FireRate = 0.45; 449 450 if (konenr == 1) 445 raketinAani.Play(); 446 ammus.Image = rakettiKuva; 447 ammus.Tag = "raketti"; 448 ammus.Size *= 2.5; 449 AddCollisionHandler(ammus, delegate (PhysicsObject a, PhysicsObject b) 450 { 451 a.Destroy(); 452 Explosion rajahdys = new Explosion(140); 453 rajahdys.Position = a.Position; 454 rajahdys.ShockwaveReachesObject += RajahdysOsuu; 455 Add(rajahdys); 456 raketinAani.Stop(); 457 }); 458 pelaaja.Ase.FireRate = 0.45; 459 460 if (konenr == 1) 461 { 462 Pelaaja[] kohdePelaajat = new Pelaaja[pelaajat.Count - 1]; 463 for (int i = 0, j = 0; i < pelaajat.Count; i++) 464 { 465 if (pelaajat[i] != pelaaja) 466 { 467 kohdePelaajat[j] = pelaajat[i]; 468 j++; 469 } 470 } 471 472 ammus.Image = hakeutuvaRakettikuva; 473 474 475 FollowerBrain seuraajanAivot = new FollowerBrain(kohdePelaajat); 476 seuraajanAivot.TurnSpeed = UnlimitedAngle.FromDegrees(45); 477 //seuraajanAivot.TurnWhileMoving = true; 478 seuraajanAivot.Speed = 450; 479 ammus.Brain = seuraajanAivot; 480 481 Timer ajastin = new Timer(); 482 ajastin.Interval = 0.1; 483 ajastin.Timeout += delegate 484 { 485 ammus.AbsoluteAngle = ammus.Velocity.Angle; 486 if (ammus.IsDestroyed) 487 { 488 ajastin.Stop(); 489 } 490 }; 491 ajastin.Start(); 492 } 493 } 494 else 451 495 { 452 Pelaaja[] kohdePelaajat = new Pelaaja[pelaajat.Count - 1]; 453 for (int i = 0, j = 0; i < pelaajat.Count; i++) 454 { 455 if (pelaajat[i] != pelaaja) 496 ammus.Image = haulikkoAmmusKuva; 497 ammus.Tag = "haulikko"; 498 AddCollisionHandler(ammus, delegate (PhysicsObject a, PhysicsObject b) 499 { 500 a.Destroy(); 501 }); 502 pelaaja.Ase.FireRate = 10000; 503 504 int maara = 10; 505 Timer haulikkoajastin = new Timer(); 506 haulikkoajastin.Interval = 0.01; 507 haulikkoajastin.Timeout += delegate 508 { 509 ammus = pelaaja.Ase.Shoot(); 510 if (ammus != null) 456 511 { 457 kohdePelaajat[j] = pelaajat[i]; 458 j++; 459 } 460 } 461 462 ammus.Image = hakeutuvaRakettikuva; 463 464 465 FollowerBrain seuraajanAivot = new FollowerBrain(kohdePelaajat); 466 seuraajanAivot.TurnSpeed = UnlimitedAngle.FromDegrees(45); 467 //seuraajanAivot.TurnWhileMoving = true; 468 seuraajanAivot.Speed = 450; 469 ammus.Brain = seuraajanAivot; 470 471 Timer ajastin = new Timer(); 472 ajastin.Interval = 0.1; 473 ajastin.Timeout += delegate 474 { 475 ammus.AbsoluteAngle = ammus.Velocity.Angle; 476 if (ammus.IsDestroyed) 477 { 478 ajastin.Stop(); 512 ammus.Position += pelaaja.Ase.Angle.GetVector() * 70; 513 ammus.Image = haulikkoAmmusKuva; 514 ammus.Tag = "haulikko"; 515 Vector suunta = Vector.FromLengthAndAngle(ammus.Velocity.Magnitude, (ammus.Velocity.Angle) + Angle.FromDegrees(RandomGen.NextDouble(-3.0, 3.0))); 516 ammus.Velocity = suunta; 517 AddCollisionHandler(ammus, delegate (PhysicsObject a, PhysicsObject b) 518 { 519 a.Destroy(); 520 }); 479 521 } 480 522 }; 481 ajastin.Start(); 523 haulikkoajastin.Start(maara); 524 Timer.SingleShot(0.01 * maara + 0.01, delegate 525 { 526 pelaaja.Ase.FireRate = 0.5; 527 }); 482 528 } 483 529 break; … … 490 536 ammus.Size *= 5; 491 537 ammus.MaximumLifetime = new TimeSpan(0, 0, 4); 492 pelaaja.Ase.FireRate = 0. 5;538 pelaaja.Ase.FireRate = 0.75; 493 539 } 494 540 // Tähän tulee laser, ei pallo … … 567 613 } 568 614 pelaaja.voiLiikkua = true; 569 pelaaja.Ase.FireRate = 0. 45;615 pelaaja.Ase.FireRate = 0.2; 570 616 }); 571 617 } … … 614 660 void Boosti(Pelaaja pelaaja, int konenr) 615 661 { 662 // Koneelle 0 pelkkä boosti 616 663 if (pelaaja.boosti) 617 664 { 618 665 int nopeus = 1000; 619 666 667 // Koneelle 1 näkymättömyys 620 668 if (konenr == 1) 621 669 { … … 630 678 pelaaja.Ase.IsVisible = true; 631 679 }); 680 } 681 682 // Koneelle 2 pelkkä shield, ei boostia 683 if (konenr == 2) 684 { 685 GameObject shield = new GameObject(pelaaja.Width+10, pelaaja.Height+10); 686 shield.Image = suojaKilpiKuva; 687 pelaaja.Add(shield); 688 689 GameObject tykkiShield = new GameObject(pelaaja.Ase.Width, pelaaja.Ase.Height); 690 tykkiShield.Image = suojaKilpiTykkiKuva; 691 pelaaja.Ase.Add(tykkiShield); 692 693 pelaaja.IgnoresExplosions = true; 694 pelaaja.vahinkoKerroin = 0; 695 696 pelaaja.boosti = false; 697 shieldAani.Play(); 698 699 Timer.SingleShot(1.75, delegate 700 { 701 pelaaja.IgnoresExplosions = false; 702 pelaaja.vahinkoKerroin = 1; 703 shield.Destroy(); 704 tykkiShield.Destroy(); 705 }); 706 707 Timer.SingleShot(4.5, delegate 708 { 709 pelaaja.boosti = true; 710 }); 711 712 return; 632 713 } 633 714 -
2015/koodauskerho/AakeR/IMBT/IMBT/IMBT/IMBT.csproj.Debug.cachefile
r7096 r7110 53 53 Content\LaserAani.xnb 54 54 Content\LaserAmmusAani.xnb 55 Content\ShieldAani2.xnb -
2015/koodauskerho/AakeR/IMBT/IMBT/IMBT/obj/x86/Debug/ContentPipeline-{B6A1F4C9-F2E2-4290-A5B5-3717058CC989}.xml
r7096 r7110 487 487 <Output>C:\MyTemp\AakeR\IMBT\IMBT\IMBT\bin\x86\Debug\Content\LaserAmmusAani.xnb</Output> 488 488 <Time>2015-12-12T12:53:05.7033058+02:00</Time> 489 </Item> 490 <Item> 491 <Source>ShieldAani2.wav</Source> 492 <Name>ShieldAani2</Name> 493 <Importer>WavImporter</Importer> 494 <Processor>SoundEffectProcessor</Processor> 495 <Options>None</Options> 496 <Output>C:\MyTemp\AakeR\IMBT\IMBT\IMBT\bin\x86\Debug\Content\ShieldAani2.xnb</Output> 497 <Time>2016-01-16T12:26:23.6876422+02:00</Time> 489 498 </Item> 490 499 <BuildSuccessful>true</BuildSuccessful> -
2015/koodauskerho/AakeR/IMBT/IMBT/IMBT/obj/x86/Debug/IMBT.csproj.FileListAbsolute.txt
r7096 r7110 61 61 C:\MyTemp\AakeR\IMBT\IMBT\IMBT\bin\x86\Debug\Content\LaserAani.xnb 62 62 C:\MyTemp\AakeR\IMBT\IMBT\IMBT\bin\x86\Debug\Content\LaserAmmusAani.xnb 63 C:\MyTemp\AakeR\IMBT\IMBT\IMBT\bin\x86\Debug\Content\ShieldAani2.xnb -
2015/koodauskerho/AakeR/IMBT/IMBT/IMBT/obj/x86/Debug/cachefile-{B6A1F4C9-F2E2-4290-A5B5-3717058CC989}-targetpath.txt
r7096 r7110 53 53 Content\LaserAani.xnb 54 54 Content\LaserAmmusAani.xnb 55 Content\ShieldAani2.xnb -
2015/koodauskerho/AakeR/IMBT/IMBT/IMBTContent/IMBTContent.contentproj
r7096 r7110 367 367 </Compile> 368 368 </ItemGroup> 369 <ItemGroup> 370 <Compile Include="ShieldAani2.wav"> 371 <Name>ShieldAani2</Name> 372 <Importer>WavImporter</Importer> 373 <Processor>SoundEffectProcessor</Processor> 374 </Compile> 375 </ItemGroup> 369 376 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 370 377 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.