- Timestamp:
- 2012-06-29 10:49:04 (11 years ago)
- Location:
- 2012/26/AleksanteriV/Polla ja Rosvo/Poliisi ja Rosvo/Poliisi ja Rosvo
- Files:
-
- 6 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/26/AleksanteriV/Polla ja Rosvo/Poliisi ja Rosvo/Poliisi ja Rosvo/Poliisi ja Rosvo/Poliisi_ja_Rosvo.cs
r3333 r3366 22 22 ClearAll(); 23 23 24 IsFullScreen = true; 25 24 26 MultiSelectWindow valikko = new MultiSelectWindow("Tervetuloa peliin: Poliisi ja Rosvo", 25 "Kenttä 1 ", "Kenttä 2", "Kenttä 3","Kenttä 4","Kenttä 5 1-4.","Kenttä 6","Kenttä 7 1-4","Kenttä 8 1-3","Lopeta");27 "Kenttä 1 2p.", "Kenttä 2 2p.", "Kenttä 3 2p.", "Kenttä 4 2p.", "Kenttä 5 4p.", "Kenttä 6", "Kenttä 7 4p.", "Kenttä 8 3p.", "Kenttä 9 4p.", "Kenttä 10 2p."); 26 28 valikko.ItemSelected += PainettiinValikonNappia; 27 29 valikko.Color = Color.Green; … … 29 31 Add(valikko); 30 32 } 31 33 void PainettiinValikonNappia(int valinta) 34 { 35 switch (valinta) 36 { 37 case 0: 38 AloitaPeli("kentta3"); 39 break; 40 case 1: 41 AloitaPeli("kentta4"); 42 break; 43 case 2: 44 AloitaPeli("kentta2"); 45 break; 46 case 3: 47 AloitaPeli("Kenttä"); 48 break; 49 case 4: 50 AloitaPeli("kentta5"); 51 break; 52 case 5: 53 AloitaPeli("kentta6"); 54 break; 55 case 6: 56 AloitaPeli("kentta7"); 57 break; 58 case 7: 59 AloitaPeli("kentta8"); 60 break; 61 case 8: 62 AloitaPeli("kentta9"); 63 break; 64 case 9: 65 AloitaPeli("kentta10"); 66 break; 67 68 } 69 } 32 70 void AloitaPeli(string kentanNimi) 33 71 { … … 37 75 Level.CreateBorders(); 38 76 LuoPistelaskuri(); 39 40 string musa = RandomGen.SelectOne<string>( 41 "nitrome - avalanche", 42 "nitrome - Canopy", 43 "nitrome - dog house", 44 "nitrome - fat cat", 45 "nitrome - office trap", 46 "the benny hill show theme song" 47 48 ); 49 MediaPlayer.Play(musa); 77 78 79 MediaPlayer.Play("the benny hill show theme song"); 50 80 51 81 PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); … … 53 83 Keyboard.Listen(Key.Space, ButtonState.Pressed, Begin, "aloita alusta"); 54 84 //Image taustaKuva = LoadImage("moi"); 55 Level.BackgroundColor = Color. Black;85 Level.BackgroundColor = Color.DarkRed; 56 86 Level.Background.Image = LoadImage("moi"); 57 87 Level.Background.ScaleToLevelFull(); … … 69 99 kentta.SetTileMethod(Color.Blue, Luopelaaja4); 70 100 kentta.SetTileMethod(Color.Gray, LuoHarmaaPalikka); 101 kentta.SetTileMethod(new Color(0, 255, 255), Luopallo); 71 102 kentta.SetTileMethod(new Color(255, 255, 0), LuoPallonurmiPalikka); 72 103 kentta.SetTileMethod(new Color(255, 106, 0), LuoOranssiPalikka); … … 112 143 Add(palikka); 113 144 } 114 void LuoPallonurmiPalikka(Vector paikka, double leveys, double korkeus) 115 { 116 117 145 void Luopallo(Vector paikka, double leveys, double korkeus) 146 { 118 147 pallo = new PhysicsObject(19, 19); 119 148 pallo.Position = paikka; 120 149 pallo.Shape = Shape.Circle; 121 pallo.Color = Color.White; 150 pallo.Image = LoadImage("jalkapallo"); 151 152 Add(pallo, 1); 153 AddCollisionHandler(pallo, "Rosvo", potkaisepalloa); 154 AddCollisionHandler(pallo, "Poliisi", potkaisepalloa); 155 156 } 157 void LuoPallonurmiPalikka(Vector paikka, double leveys, double korkeus) 158 { 159 160 161 pallo = new PhysicsObject(19, 19); 162 pallo.Position = paikka; 163 pallo.Shape = Shape.Circle; 164 pallo.Image = LoadImage("jalkapallo"); 122 165 123 166 Add(pallo ,1); … … 180 223 void potkaisepalloa(PhysicsObject tormaaja, PhysicsObject kohde) 181 224 { 182 tormaaja.Hit(Vector.FromLengthAndAngle( 1000, kohde.Angle));225 tormaaja.Hit(Vector.FromLengthAndAngle(500, kohde.Angle)); 183 226 } 184 227 void aloitaalusta(PhysicsObject tormaaja, PhysicsObject kohde) … … 219 262 Keyboard.Listen(Key.S, ButtonState.Released, PysaytaPelaaja2Y, null); 220 263 //---------------------------------------------------- 221 Keyboard.Listen(Key.V, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(-20 5, 0));222 Keyboard.Listen(Key.N, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(20 5, 0));223 Keyboard.Listen(Key.G, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(0, 20 5));224 Keyboard.Listen(Key.B, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(0, -20 5));264 Keyboard.Listen(Key.V, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(-200, 0)); 265 Keyboard.Listen(Key.N, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(200, 0)); 266 Keyboard.Listen(Key.G, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(0, 200)); 267 Keyboard.Listen(Key.B, ButtonState.Down, LiikutaPelaajaa3, null, new Vector(0, -200)); 225 268 226 269 Keyboard.Listen(Key.V, ButtonState.Released, PysaytaPelaaja3X, null); … … 229 272 Keyboard.Listen(Key.B, ButtonState.Released, PysaytaPelaaja3Y, null); 230 273 //---------------------------------------------------------- 231 Keyboard.Listen(Key.NumPad4, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(-20 5, 0));232 Keyboard.Listen(Key.NumPad6, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(20 5, 0));233 Keyboard.Listen(Key.NumPad8, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(0, 20 5));234 Keyboard.Listen(Key.NumPad5, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(0, -20 5));274 Keyboard.Listen(Key.NumPad4, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(-200, 0)); 275 Keyboard.Listen(Key.NumPad6, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(200, 0)); 276 Keyboard.Listen(Key.NumPad8, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(0, 200)); 277 Keyboard.Listen(Key.NumPad5, ButtonState.Down, LiikutaPelaajaa4, null, new Vector(0, -200)); 235 278 236 279 Keyboard.Listen(Key.NumPad4, ButtonState.Released, PysaytaPelaaja4X, null); … … 246 289 } 247 290 pelaaja.Move(liikuttaja); 291 pelaaja.Angle = liikuttaja.Angle + Angle.FromDegrees(90); 248 292 } 249 293 void PysaytaPelaajaX() … … 257 301 void LiikutaPelaajaa2(Vector liikuttaja)//------------------------------------------- 258 302 { 303 if (pelaajia > 2) 304 { 305 liikuttaja = liikuttaja + Vector.FromLengthAndAngle(-5, liikuttaja.Angle); 306 } 259 307 pelaaja2.Move(liikuttaja); 308 pelaaja2.Angle = liikuttaja.Angle + Angle.FromDegrees(90); 260 309 } 261 310 void PysaytaPelaaja2X() … … 270 319 { 271 320 pelaaja3.Move(liikuttaja); 321 pelaaja3.Angle = liikuttaja.Angle + Angle.FromDegrees(90); 272 322 } 273 323 void PysaytaPelaaja3X() … … 282 332 { 283 333 pelaaja4.Move(liikuttaja); 334 pelaaja4.Angle = liikuttaja.Angle + Angle.FromDegrees(90); 284 335 } 285 336 void PysaytaPelaaja4X() … … 291 342 pelaaja4.StopVertical(); 292 343 } 293 void PainettiinValikonNappia(int valinta) 294 { 295 switch (valinta) 296 { 297 case 0: 298 AloitaPeli("kentta3"); 299 break; 300 case 1: 301 AloitaPeli("kentta4"); 302 break; 303 case 2: 304 AloitaPeli("kentta2"); 305 break; 306 case 3: 307 AloitaPeli("Kenttä"); 308 break; 309 case 4: 310 AloitaPeli("kentta5"); 311 break; 312 case 5: 313 AloitaPeli("kentta6"); 314 break; 315 case 6: 316 AloitaPeli("kentta7"); 317 break; 318 case 7: 319 AloitaPeli("kentta8"); 320 break; 321 case 8: 322 Exit(); 323 break; 324 325 } 326 } 344 327 345 328 346 -
2012/26/AleksanteriV/Polla ja Rosvo/Poliisi ja Rosvo/Poliisi ja Rosvo/Poliisi ja RosvoContent/Poliisi ja RosvoContent.contentproj
r3333 r3366 95 95 </ItemGroup> 96 96 <ItemGroup> 97 <Compile Include="nitrome - avalanche.mp3">98 <Name>nitrome - avalanche</Name>99 <Importer>Mp3Importer</Importer>100 <Processor>SongProcessor</Processor>101 </Compile>102 <Compile Include="nitrome - Canopy.mp3">103 <Name>nitrome - Canopy</Name>104 <Importer>Mp3Importer</Importer>105 <Processor>SongProcessor</Processor>106 </Compile>107 <Compile Include="nitrome - dog house.mp3">108 <Name>nitrome - dog house</Name>109 <Importer>Mp3Importer</Importer>110 <Processor>SongProcessor</Processor>111 </Compile>112 <Compile Include="nitrome - fat cat.mp3">113 <Name>nitrome - fat cat</Name>114 <Importer>Mp3Importer</Importer>115 <Processor>SongProcessor</Processor>116 </Compile>117 <Compile Include="nitrome - office trap.mp3">118 <Name>nitrome - office trap</Name>119 <Importer>Mp3Importer</Importer>120 <Processor>SongProcessor</Processor>121 </Compile>122 </ItemGroup>123 <ItemGroup>124 <Compile Include="Metalli.PNG">125 <Name>Metalli</Name>126 <Importer>TextureImporter</Importer>127 <Processor>TextureProcessor</Processor>128 </Compile>129 <Compile Include="tiili palkki.png">130 <Name>tiili palkki</Name>131 <Importer>TextureImporter</Importer>132 <Processor>TextureProcessor</Processor>133 </Compile>134 </ItemGroup>135 <ItemGroup>136 97 <Compile Include="kentta5.png"> 137 98 <Name>kentta5</Name> … … 176 137 </ItemGroup> 177 138 <ItemGroup> 178 <Compile Include="seina 1.png">179 <Name>seina 1</Name>139 <Compile Include="seina2.png"> 140 <Name>seina2</Name> 180 141 <Importer>TextureImporter</Importer> 181 142 <Processor>TextureProcessor</Processor> 182 143 </Compile> 183 <Compile Include="seina2.png"> 184 <Name>seina2</Name> 144 </ItemGroup> 145 <ItemGroup> 146 <Compile Include="jalkapallo.png"> 147 <Name>jalkapallo</Name> 148 <Importer>TextureImporter</Importer> 149 <Processor>TextureProcessor</Processor> 150 </Compile> 151 </ItemGroup> 152 <ItemGroup> 153 <Compile Include="kentta9.png"> 154 <Name>kentta9</Name> 155 <Importer>TextureImporter</Importer> 156 <Processor>TextureProcessor</Processor> 157 </Compile> 158 </ItemGroup> 159 <ItemGroup> 160 <Compile Include="kentta10.png"> 161 <Name>kentta10</Name> 185 162 <Importer>TextureImporter</Importer> 186 163 <Processor>TextureProcessor</Processor>
Note: See TracChangeset
for help on using the changeset viewer.