Changeset 5051
- Timestamp:
- 2014-06-23 14:57:02 (9 years ago)
- Location:
- 2013/26/OtsoR/Projekti
- Files:
-
- 163 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/26/OtsoR/Projekti/Projekti.sln
r4203 r5051 4 4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekti", "Projekti\Projekti\Projekti.csproj", "{C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}" 5 5 EndProject 6 Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "ProjektiContent", "Projekti\ProjektiContent\ProjektiContent.contentproj", "{97999162-0C3B-480A-AB91-BD553A4EB51F}" 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjektiContent", "Projekti\ProjektiContent\ProjektiContent.contentproj", "{97999162-0C3B-480A-AB91-BD553A4EB51F}" 7 EndProject 8 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jypeli", "..\Jypeli\Jypeli.csproj", "{74DD1DDD-283D-45D7-A79D-3DCB120708A6}" 7 9 EndProject 8 10 Global 9 11 GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 12 Debug|x86 = Debug|x86 13 DebugVisualize|x86 = DebugVisualize|x86 11 14 Release|x86 = Release|x86 12 15 EndGlobalSection … … 14 17 {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Debug|x86.ActiveCfg = Debug|x86 15 18 {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Debug|x86.Build.0 = Debug|x86 19 {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.DebugVisualize|x86.ActiveCfg = Debug|x86 20 {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.DebugVisualize|x86.Build.0 = Debug|x86 16 21 {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Release|x86.ActiveCfg = Release|x86 17 22 {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Release|x86.Build.0 = Release|x86 18 23 {97999162-0C3B-480A-AB91-BD553A4EB51F}.Debug|x86.ActiveCfg = Debug|x86 24 {97999162-0C3B-480A-AB91-BD553A4EB51F}.DebugVisualize|x86.ActiveCfg = Debug|x86 19 25 {97999162-0C3B-480A-AB91-BD553A4EB51F}.Release|x86.ActiveCfg = Release|x86 26 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Debug|x86.ActiveCfg = Debug|x86 27 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Debug|x86.Build.0 = Debug|x86 28 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.DebugVisualize|x86.ActiveCfg = DebugVisualize|x86 29 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.DebugVisualize|x86.Build.0 = DebugVisualize|x86 30 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Release|x86.ActiveCfg = Release|x86 31 {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Release|x86.Build.0 = Release|x86 20 32 EndGlobalSection 21 33 GlobalSection(SolutionProperties) = preSolution -
2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.cs
r4310 r5051 103 103 shipimages[i - 1] = LoadImage("s" + i); 104 104 } 105 105 106 IsMouseVisible = true; 106 107 MultiSelectWindow numberofplayersmenu = new MultiSelectWindow("Select number of players", "1 Player", "2 Players", "Quit"); … … 108 109 Add(numberofplayersmenu); 109 110 } 111 110 112 void mainmenu(int choice) 111 113 { … … 193 195 aluskuva.Image.ReplaceColor(Color.Black, shipcolors2[shipcolor1.Value]); 194 196 } 197 195 198 void Changeship2(int vanha, int uusi) 196 199 { … … 267 270 while (shipcounter < 39) 268 271 { 269 int hostileship = RandomGen.NextInt(0, 100);270 double hostiley = 0.0;271 double hostilex = 0.0;272 if (RandomGen.NextBool())273 {274 hostiley = Level.Bottom + 2 * Level.Top * RandomGen.NextInt(0, 2);275 hostilex = RandomGen.NextDouble(Level.Left, Level.Right);276 }277 else278 {279 hostiley = RandomGen.NextDouble(Level.Bottom, Level.Top);280 hostilex = Level.Left + 2 * Level.Right * RandomGen.NextInt(0, 2);281 }282 Createhostile(hostileship, hostiley, hostilex);283 shipcounter++;272 int hostileship = RandomGen.NextInt(0, 100); 273 double hostiley = 0.0; 274 double hostilex = 0.0; 275 if (RandomGen.NextBool()) 276 { 277 hostiley = Level.Bottom + 2 * Level.Top * RandomGen.NextInt(0, 2); 278 hostilex = RandomGen.NextDouble(Level.Left, Level.Right); 279 } 280 else 281 { 282 hostiley = RandomGen.NextDouble(Level.Bottom, Level.Top); 283 hostilex = Level.Left + 2 * Level.Right * RandomGen.NextInt(0, 2); 284 } 285 Createhostile(hostileship, hostiley, hostilex); 286 shipcounter++; 284 287 } 285 288 while (bigshipcounter < 4) … … 420 423 topedge.CollisionIgnoreGroup = 2; 421 424 } 425 422 426 void coop() 423 427 { … … 451 455 shipcolor2 = new IntMeter(0, 0, 3); 452 456 shipcolor2.Changed += Changeship2; 453 shipcolour2.BindTo(shipcolor2); 454 457 shipcolour2.BindTo(shipcolor2); 458 455 459 shipimg2 = new IntMeter(1, 1, 100); 456 460 shipimg2.Changed += Changeship2; … … 485 489 shiptype.Y = 200; 486 490 shiptype.BindTo(shipimg); 487 491 488 492 Slider shipweapon = new Slider(125, 15); 489 493 shipweapon.X = -225; … … 495 499 shiptype2.Y = 200; 496 500 shiptype2.BindTo(shipimg2); 497 501 498 502 Slider shipweapon2 = new Slider(125, 15); 499 503 shipweapon2.X = 425; … … 518 522 Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, coopbase, null); 519 523 } 524 520 525 void choice(int choice) 521 526 { … … 586 591 } 587 592 } 593 588 594 void fire(Weapon ase, Player ship) 589 595 { … … 711 717 Mouse.Listen(MouseButton.Left, ButtonState.Down, fire, null, weapon, ship1); 712 718 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 719 Keyboard.Listen(Key.K, ButtonState.Pressed, delegate { MessageDisplay.Add(ship1.Position.ToString()); }, null); 713 720 } 714 721 void Aim(AnalogState hiirenLiike, Player ship) … … 743 750 ship.Push(shipdirection); 744 751 } 752 745 753 void tilt(double direction, Player ship) 746 754 { 747 755 ship.AngularAcceleration = 10.0 * direction; 748 756 } 757 749 758 void singleplayerbase() 750 759 { 751 760 ClearAll(); 761 GameObject background = new GameObject(1500, 1500); 752 762 Level.Background.CreateStars(); 753 Level.CreateBorders(); 754 Camera.ZoomToLevel(); 763 background.Image = Level.Background.Image; 764 background.Tag = "background"; 765 Add(background, -1); 766 Level.Background.Image = null; 767 768 Level.Size = new Vector(1500, 1500); 769 createedges(); 755 770 Createship(0, 0); 771 Camera.Zoom(2); 772 Camera.Follow(ship1); 773 Camera.StayInLevel = true; 756 774 Spawnhostiles(); 757 775 Controlsship(); 758 776 759 777 Timer spawnrune = new Timer(); 760 spawnrune.Interval = 1 5;778 spawnrune.Interval = 10; 761 779 spawnrune.Timeout += Spawnrunes; 762 780 spawnrune.Start(); … … 780 798 { 781 799 ClearAll(); 800 //Level.Background.CreateStars(); 801 GameObject background = new GameObject(Screen.Width * 2, Screen.Height * 2); 782 802 Level.Background.CreateStars(); 783 Level.CreateBorders(); 784 Camera.ZoomToLevel(); 803 background.Image = Level.Background.Image; 804 Add(background, -3); 805 Level.Background.Image = null; 806 createedges(); 807 //Camera.ZoomToLevel(); 785 808 Createship(-100, 0); 786 809 Createship2(100, 0); … … 811 834 void Spawnrunes() 812 835 { 813 if (runecounter < 5)836 if (runecounter < 6) 814 837 { 815 838 int runetype = RandomGen.NextInt(1, 3); 816 839 double runey = 0.0; 817 840 double runex = 0.0; 818 Vector paikka = Level.GetRandomFreePosition(5.0);841 Vector paikka = GetRandomFreePosition("background", 5.0); 819 842 runey = paikka.Y; 820 843 runex = paikka.X; … … 856 879 } 857 880 } 881 858 882 void damagerune(PhysicsObject rune, Player ship) 859 883 { 860 884 rune.Destroy(); 861 885 weapon.FireRate *= 2; 862 Timer.SingleShot(10.0, delegate { weapon.FireRate /= 2; }); 863 MessageDisplay.Add("Firerate improved"); 886 Timer.SingleShot(15.0, delegate { 887 weapon.FireRate /= 2; } 888 ); 889 MessageDisplay.Add("Weapons Improved"); 864 890 MediaPlayer.Play("Damage"); 865 891 runecounter--; … … 877 903 // 878 904 //} 905 906 /// <summary> 907 /// Palauttaa satunnaisen vapaan paikan kentän sisältä. 908 /// </summary> 909 /// <param name="ignoresTag">Minkätagisia olioita ei huomioida.</param> 910 /// <param name="radius">Alueen halkaisija, jonka tulee olla vapaana paikan ympärillä.</param> 911 /// <returns>Vapaa paikka.</returns> 912 Vector GetRandomFreePosition(String ignoresTag, double radius) 913 { 914 Vector pos; 915 do 916 { 917 pos = RandomGen.NextVector(Level.Left, Level.Bottom, Level.Right, Level.Top); 918 919 } while(IsOccupied(pos, ignoresTag, radius)); 920 return pos; 921 } 922 923 bool IsOccupied(Vector position, String ignoresTag, double radius) 924 { 925 GameObject o = GetObjectAt(position, radius); 926 if (o == null) return false; 927 if (o.Tag.ToString() == ignoresTag) return false; 928 return true; 929 } 879 930 } -
2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.csproj
r4203 r5051 62 62 </PropertyGroup> 63 63 <ItemGroup> 64 <Reference Include="Jypeli">65 </Reference>66 64 <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> 67 65 <Private>False</Private> … … 120 118 </ItemGroup> 121 119 <ItemGroup> 120 <ProjectReference Include="..\..\..\Jypeli\Jypeli.csproj"> 121 <Project>{74DD1DDD-283D-45D7-A79D-3DCB120708A6}</Project> 122 <Name>Jypeli</Name> 123 </ProjectReference> 122 124 <ProjectReference Include="..\ProjektiContent\ProjektiContent.contentproj"> 123 125 <Name>ProjektiContent</Name>
Note: See TracChangeset
for help on using the changeset viewer.