- Timestamp:
- 2011-08-05 12:27:37 (12 years ago)
- Location:
- 2011/31/DanH
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/31/DanH/Dragonfighter/Dragonfighter/Dragonfighter/Dragonfighter.csproj
r2564 r2600 125 125 <CopyToOutputDirectory>Always</CopyToOutputDirectory> 126 126 </Content> 127 <Content Include="Slayer - Raining Blood.mp3" /> 127 128 <Content Include="Stance.png" /> 128 129 <Content Include="StanceGood.png" /> -
2011/31/DanH/Dragonfighter/Dragonfighter/Dragonfighter/Peli.cs
r2564 r2600 12 12 { 13 13 14 List<Label> valikonKohdat; 15 16 14 17 15 18 Image olionKuva = LoadImage("Thunderbolt3"); … … 19 22 20 23 21 const double nopeus = 450;22 const double hyppyNopeus = 1500;24 const double nopeus = 360; 25 const double hyppyNopeus = 2000; 23 26 const int RUUDUN_KOKO = 50; 24 27 … … 52 55 53 56 54 55 56 57 58 59 57 58 59 60 61 62 63 60 64 61 65 … … 70 74 71 75 public override void Begin() 72 { 73 74 75 76 77 78 pelaaja1Elama = new DoubleMeter( 100 ); 79 pelaaja1Elama.MaxValue = 100; 80 81 pelaaja2Elama = new DoubleMeter(100); 82 pelaaja2Elama.MaxValue = 100; 83 84 85 paikallaanOikealle = Image.Mirror(paikallaanVasemmalle); 86 kavelyOikealle = Image.Mirror(kavelyVasemmalle); 87 88 paikallaanOikealle2 = Image.Mirror(paikallaanVasemmalle2); 89 kavelyOikealle2 = Image.Mirror(kavelyVasemmalle2); 90 91 92 Gravity = new Vector(0, -900); 93 94 luoKentta(); 95 lisaaNappaimet(); 96 97 IsFullScreen = true; 98 99 Camera.ZoomToLevel(); 100 101 76 { 77 78 { 79 Valikko(); 80 } 81 82 83 102 84 } 103 104 105 106 107 108 109 85 110 86 … … 123 99 kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 124 100 Level.CreateBorders(); 125 Level.Background.CreateGradient(Color. White, Color.Blue);101 Level.Background.CreateGradient(Color.Green, Color.Blue); 126 102 127 103 … … 143 119 pelaaja1 = new PlatformCharacter (leveys, korkeus); 144 120 pelaaja1.Position = paikka; 145 pelaaja1.Mass = 1.0;121 pelaaja1.Mass = 7.0; 146 122 pelaaja1.Image = Dragon; 147 123 … … 152 128 153 129 pelaaja1.Weapon = new PlasmaCannon(20, 5); 154 130 pelaaja1.Weapon.IsVisible = false; 131 pelaaja1.Weapon.Ammo.Value = int.MaxValue; 155 132 pelaaja1.Weapon.ProjectileCollision = AmmusOsui; 156 133 … … 167 144 pelaaja1ElamaPalkki.Color = Color.Black; 168 145 pelaaja1ElamaPalkki.BarColor = Color.Red; 146 169 147 Add(pelaaja1ElamaPalkki); 170 148 … … 181 159 pelaaja2 = new PlatformCharacter(leveys, korkeus); 182 160 pelaaja2.Position = paikka; 183 pelaaja2.Mass = 4.0;161 pelaaja2.Mass = 7.0; 184 162 pelaaja2.Image = Hunter; 185 163 … … 187 165 188 166 pelaaja2.Weapon = new PlasmaCannon(20, 5); 189 167 pelaaja2.Weapon.IsVisible = false; 168 pelaaja2.Weapon.Ammo.Value = int.MaxValue; 190 169 pelaaja2.Weapon.ProjectileCollision = AmmusOsui2; 191 192 170 pelaaja2.LeftIdleAnimation = new Animation(paikallaanVasemmalle2); 193 171 pelaaja2.RightIdleAnimation = new Animation(paikallaanOikealle2); … … 223 201 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Näytä ohjeet"); 224 202 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Poistu pelistä"); 225 226 Keyboard.Listen(Key.Left, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, - nopeus); 227 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 228 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 229 Keyboard.Listen(Key.L, ButtonState.Pressed, AmmuAseella, "Ammu"); 203 Keyboard.Listen(Key.P, ButtonState.Pressed, Valikko, "Palaa valikkoon"); 204 205 Keyboard.Listen(Key.A, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, - nopeus); 206 Keyboard.Listen(Key.D, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja1, nopeus); 207 Keyboard.Listen(Key.W, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja1, hyppyNopeus); 208 Keyboard.Listen(Key.G, ButtonState.Pressed, AmmuAseella, "Ammu"); 230 209 231 210 ControllerOne.Listen(Button.Back, ButtonState.Pressed, Exit, "Poistu pelistä"); … … 236 215 237 216 238 Keyboard.Listen(Key. A, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus);239 Keyboard.Listen(Key. D, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja2, nopeus);240 Keyboard.Listen(Key. W, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja2, hyppyNopeus);241 Keyboard.Listen(Key. G, ButtonState.Pressed, AmmuAseella2, "Ammu" );242 243 217 Keyboard.Listen(Key.Left, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja2, -nopeus); 218 Keyboard.Listen(Key.Right, ButtonState.Down, liikuta, "Liikkuu vasemmalle", pelaaja2, nopeus); 219 Keyboard.Listen(Key.Up, ButtonState.Pressed, hyppaa, "Pelaaja hyppää", pelaaja2, hyppyNopeus); 220 Keyboard.Listen(Key.L, ButtonState.Pressed, AmmuAseella2, "Ammu" ); 221 222 244 223 245 224 … … 262 241 { 263 242 PhysicsObject ammus = pelaaja1.Weapon.Shoot(); 264 243 265 244 if (ammus != null) 245 266 246 { 267 247 ammus.Size *= 5; … … 276 256 277 257 if (ammus2 != null) 258 278 259 { 279 260 ammus2.Size *= 5; … … 297 278 { 298 279 pelaaja2Elama.Value--; 299 } 280 281 282 if (pelaaja2Elama.Value == 0) 283 { 284 pelaaja2.Destroy(); 285 } 286 287 } 288 300 289 301 290 … … 305 294 void AmmusOsui2(PhysicsObject ammus2, PhysicsObject kohde) 306 295 { 296 ammus2.Destroy(); 307 297 308 298 if (kohde == pelaaja1) … … 310 300 pelaaja1Elama.Value--; 311 301 } 312 ammus2.Destroy(); 313 314 315 } 316 317 318 319 320 302 if (pelaaja1Elama.Value == 0) 303 { 304 pelaaja1.Destroy(); 305 306 } 307 308 309 } 310 311 312 313 314 void Valikko() 315 { 316 ClearAll(); 317 valikonKohdat = new List<Label>(); 318 319 Label kohta1 = new Label("Start"); 320 kohta1.Position = new Vector(0, 40); 321 valikonKohdat.Add(kohta1); 322 323 Label kohta2 = new Label("Exit"); 324 kohta2.Position = new Vector(0, -40); 325 326 valikonKohdat.Add(kohta2); 327 328 foreach (Label valikonKohta in valikonKohdat) 329 { 330 Add(valikonKohta); 331 } 332 333 Mouse.ListenOn(kohta1, MouseButton.Left, ButtonState.Pressed, AloitaPeli, null); 334 Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, Exit, null); 335 336 Mouse.IsCursorVisible = true; 337 Mouse.ListenMovement(1.0, ValikossaLiikkuminen, null); 338 Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, ""); 339 } 340 341 void ValikossaLiikkuminen(AnalogState hiirenTila) 342 { 343 foreach (Label kohta in valikonKohdat) 344 { 345 if (Mouse.IsCursorOn(kohta)) 346 { 347 kohta.TextColor = Color.Red; 348 } 349 else 350 { 351 kohta.TextColor = Color.Black; 352 } 353 354 } 355 } 356 357 void AloitaPeli() 358 { 359 ClearAll(); 360 MessageDisplay.Add("Song: Slayer-Raining Blood"); 361 MessageDisplay.MessageTime = new TimeSpan(0, 0, 10); 362 363 364 365 366 pelaaja1Elama = new DoubleMeter(100); 367 pelaaja1Elama.MaxValue = 100; 368 369 pelaaja2Elama = new DoubleMeter(100); 370 pelaaja2Elama.MaxValue = 100; 371 372 373 paikallaanOikealle = Image.Mirror(paikallaanVasemmalle); 374 kavelyOikealle = Image.Mirror(kavelyVasemmalle); 375 376 paikallaanOikealle2 = Image.Mirror(paikallaanVasemmalle2); 377 kavelyOikealle2 = Image.Mirror(kavelyVasemmalle2); 378 379 380 Gravity = new Vector(0, -1900); 381 382 luoKentta(); 383 lisaaNappaimet(); 384 385 IsFullScreen = true; 386 387 Camera.ZoomFactor = 0.6; 388 389 390 391 392 393 394 MediaPlayer.Play("Slayer - Raining Blood"); 395 } 396 321 397 322 398 323 399 324 400 } 401 402 403 404 405 406 -
2011/31/DanH/Dragonfighter/Dragonfighter/Dragonfighter/kentta1.txt
r2564 r2600 1 1 2 2 3 3 4 5 6 7 ############### 8 9 ### ### 10 11 12 13 14 ### ##### ### 4 15 5 16 6 17 7 18 8 9 ###########10 19 11 12 ### ### ### 13 14 15 N # X 16 ############################ 20 ### ### 21 N # X 22 ################################## -
2011/31/DanH/Dragonfighter/Dragonfighter/DragonfighterContent/DragonfighterContent.contentproj
r2564 r2600 100 100 </Compile> 101 101 </ItemGroup> 102 <ItemGroup> 103 <Compile Include="Slayer - Raining Blood.mp3"> 104 <Name>Slayer - Raining Blood</Name> 105 <Importer>Mp3Importer</Importer> 106 <Processor>SongProcessor</Processor> 107 </Compile> 108 </ItemGroup> 102 109 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 103 110 <!-- 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.