Changeset 4295 for 2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.cs
- Timestamp:
- 2013-06-28 10:53:42 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.cs
r4286 r4295 92 92 IntMeter shipcolor2; 93 93 IntMeter shipWeapon2; 94 IntMeter points; 94 95 int shipcounter; 95 96 int bigshipcounter; … … 382 383 void enemydeath() 383 384 { 384 //shipcounter--; 385 shipcounter--; 386 points.Value += 5; 385 387 } 386 388 void bigenemydeath() 387 389 { 388 //bigshipcounter--; 390 bigshipcounter--; 391 points.Value += 40; 389 392 } 390 393 void boss1death() … … 599 602 ammus.Size *= 0.4; 600 603 ammus.CollisionIgnoreGroup = 4; 601 AddCollisionHandler(ammus, CollisionHandler.DestroyObject);604 AddCollisionHandler(ammus, AmmusOsui); 602 605 } 603 606 if (ase is LaserGun) … … 610 613 { 611 614 ammus.Size *= 0.9; 612 AddCollisionHandler(ammus, CollisionHandler.DestroyObject);615 AddCollisionHandler(ammus, AmmusOsui); 613 616 ammus.IgnoresCollisionResponse = true; 614 617 ammus.CollisionIgnoreGroup = 3; … … 634 637 } 635 638 } 639 void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 640 { 641 if (kohde.Tag == "powerup") 642 { 643 return; 644 } 645 ammus.Destroy(); 646 } 647 636 648 void missilehit(PhysicsObject tormaaja, PhysicsObject kohde) 637 649 { 638 tormaaja.Destroy(); 650 if (kohde.Tag == "powerup") 651 { 652 return; 653 } 639 654 Explosion missilecrash = new Explosion(8); 640 655 missilecrash.Position = tormaaja.Position; 641 656 missilecrash.UseShockWave = false; 642 657 Add(missilecrash); 658 tormaaja.Destroy(); 643 659 } 644 660 void firehoming(Weapon ase) … … 741 757 Controlsship(); 742 758 759 Timer spawnrune = new Timer(); 760 spawnrune.Interval = 15; 761 spawnrune.Timeout += Spawnrunes; 762 spawnrune.Start(); 763 764 points = new IntMeter(0); 765 Label pointsdisplay = new Label(); 766 pointsdisplay.Title = "Points"; 767 pointsdisplay.X = Screen.Right - 100; 768 pointsdisplay.Y = Screen.Top - 100; 769 pointsdisplay.TextColor = Color.White; 770 pointsdisplay.Color = Color.Black; 771 pointsdisplay.BindTo(points); 772 Add(pointsdisplay); 773 743 774 Timer a = new Timer(); 744 775 a.Interval = 8; … … 758 789 Controlsship2(); 759 790 760 Timer a = new Timer(); 761 a.Interval = 8; 762 a.Timeout += Spawnhostiles; 763 a.Start(); 764 } 765 791 Timer spawnrune = new Timer(); 792 spawnrune.Interval = 15; 793 spawnrune.Timeout += Spawnrunes; 794 spawnrune.Start(); 795 796 points = new IntMeter(0); 797 Label pointsdisplay = new Label(); 798 pointsdisplay.Title = "Points"; 799 pointsdisplay.X = Screen.Right - 100; 800 pointsdisplay.Y = Screen.Top - 100; 801 pointsdisplay.TextColor = Color.White; 802 pointsdisplay.Color = Color.Black; 803 pointsdisplay.BindTo(points); 804 Add(pointsdisplay); 805 806 Timer spawnenemy = new Timer(); 807 spawnenemy.Interval = 8; 808 spawnenemy.Timeout += Spawnhostiles; 809 spawnenemy.Start(); 810 } 766 811 void Spawnrunes() 767 812 { 768 813 while (runecounter < 5) 769 814 { 770 int runetype = RandomGen.NextInt( 0, 2);815 int runetype = RandomGen.NextInt(1, 3); 771 816 double runey = 0.0; 772 817 double runex = 0.0; 773 if (RandomGen.NextBool()) 774 { 775 runey = Level.Bottom + 2 * Level.Top * RandomGen.NextInt(0, 2); 776 runex = RandomGen.NextDouble(Level.Left, Level.Right); 777 } 778 else 779 { 780 runey = RandomGen.NextDouble(Level.Bottom, Level.Top); 781 runex = Level.Left + 2 * Level.Right * RandomGen.NextInt(0, 2); 782 } 783 Createhostile(runetype, runey, runex); 818 Vector paikka = Level.GetRandomFreePosition(5.0); 819 runey = paikka.Y; 820 runex = paikka.X; 821 Createrune(runetype, runey, runex); 784 822 runecounter++; 785 823 } … … 787 825 void Createrune(int runetype, double y, double x) 788 826 { 789 PhysicsObject Rune = new PhysicsObject( 5, 5);827 PhysicsObject Rune = new PhysicsObject(10, 10); 790 828 Rune.X = x; 791 829 Rune.Y = y; 792 830 Rune.CollisionIgnoreGroup = 2 & 3 & 4; 831 Rune.IgnoresCollisionResponse = true; 832 Rune.MakeStatic(); 833 Rune.Tag = "powerup"; 834 Rune.AngularVelocity = 5; 835 Add(Rune); 793 836 switch (runetype) 794 837 { … … 796 839 //Addcollision 797 840 Rune.Image = rdamage; 841 Rune.Height = 15; 842 Rune.Width = 10; 798 843 AddCollisionHandler(Rune, "player", delegate(PhysicsObject tormaaja, Player ship) { damagerune(tormaaja, ship); }); 799 844 break; … … 801 846 //Addcollision 802 847 Rune.Image = rrepair; 803 AddCollisionHandler(Rune, "player", delegate(PhysicsObject tormaaja, Player ship) { damagerune(tormaaja, ship); }); 848 AddCollisionHandler(Rune, "player", delegate(PhysicsObject tormaaja, Player ship) { repairrune(tormaaja, ship); }); 849 Rune.Height = 14; 850 Rune.Width = 14; 804 851 break; 805 852 case 3: … … 812 859 { 813 860 rune.Destroy(); 861 weapon.FireRate *= 2; 862 Timer.SingleShot(10, delegate{ weapon.FireRate *=0.5; }); 863 runecounter--; 814 864 } 815 865 void repairrune(PhysicsObject rune, Player ship) 816 866 { 867 ship.Health.Value += 100; 817 868 rune.Destroy(); 869 runecounter--; 818 870 } 819 871 //void rune3(PhysicsObject rune, Player ship)
Note: See TracChangeset
for help on using the changeset viewer.