Changeset 3397
- Timestamp:
- 2012-06-29 12:21:04 (11 years ago)
- Location:
- 2012/26/MikaL/Zombie Survival/Zombie Survival
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/26/MikaL/Zombie Survival/Zombie Survival/Zombie Survival/Zombie_Survival.cs
r3379 r3397 24 24 peli.rahaLaskuri.Value += 50; 25 25 this.Destroy(); 26 peli.SpawnaaZombi(); 26 peli.SpawnAjastin(); 27 } 28 29 public override void Update(Time time) 30 { 31 base.Update(time); 32 Angle = Velocity.Angle; 27 33 } 28 34 } … … 51 57 52 58 DoubleMeter p1_hp; 59 DoubleMeter p2_hp; 53 60 54 61 … … 77 84 zombipaikat = new List<Vector>(); 78 85 79 SetWindowSize(1024, 768, true);86 SetWindowSize(1024, 768, false); 80 87 if (DataStorage.Exists("scores.xml")) topLista = DataStorage.Load<ScoreList>(topLista, "scores.xml"); 81 88 … … 91 98 void StartGame() 92 99 { 100 //multiplayer.Value = 0; 93 101 zombipaikat.Clear(); 94 102 ui(); 95 103 LuoMap(); 96 104 controls(); 97 98 105 LuoKillLaskuri(); 99 106 LuoRahalaskuri(); … … 135 142 void LuoMap() 136 143 { 137 SetWindowSize(1024, 768, false);138 144 ColorTileMap ruudut = ColorTileMap.FromLevelAsset("map"); 139 145 ruudut.SetTileMethod(Color.Black, TeeSeina); … … 147 153 Level.Background.Image = lol; 148 154 Camera.ZoomToLevel(); 155 LuoZombi(); 156 LuoZombi(); 157 LuoZombi(); 158 149 159 150 160 … … 198 208 ak2.Image = null; 199 209 ak2.Color = Color.Transparent; 200 ak 1.ProjectileCollision = AmmusOsui;201 ak 1.Ammo.Value = p1_lipas.Value;210 ak2.ProjectileCollision = AmmusOsui; 211 ak2.Ammo.Value = p1_lipas.Value; 202 212 p2.Add(ak2); 203 213 } 204 public void SpawnaaZombi() 205 { 206 //Tee ajastin 214 public void SpawnAjastin() 215 { 216 Timer ajastin = new Timer(); 217 ajastin.Interval = 6.5; 218 ajastin.Timeout += LuoZombi; 219 ajastin.Start(); 220 221 Timer ajastin2 = new Timer(); 222 ajastin2.Interval = 30; 223 ajastin2.Timeout += LuoZombi; 224 ajastin2.Start(); 225 207 226 } 208 227 void TeeZombiPaikka(Vector paikka, double leveys, double korkeus) … … 291 310 292 311 ControllerOne.Listen(Button.Y, ButtonState.Pressed, Use, null, p2); 312 ControllerOne.Listen(Button.RightShoulder, ButtonState.Down, Shoot, null, p2); 313 ControllerOne.Listen(Button.X, ButtonState.Pressed, Reload, null, p2); 293 314 294 315 } … … 331 352 //Ase 332 353 LuoAse(-100, Level.Top + 70); 333 LuoAse( Level.Left + 20, Level.Bottom + 100);354 LuoAse(-505, Level.Bottom + 100); 334 355 if(multiplayer == 1) LuoAse(+100, Level.Top + 70); 335 356 … … 344 365 345 366 //p2_hp 346 DoubleMeter p2_hp = new DoubleMeter(100);367 p2_hp = new DoubleMeter(5); 347 368 Label player2 = new Label("Player 2"); 348 369 player2.X = Screen.Left + 40; 349 370 player2.Y = Screen.Top - 40; 350 p2_hp.MaxValue = 100;371 p2_hp.MaxValue = 5; 351 372 ProgressBar p2_hpPalkki = new ProgressBar(170, 20); 352 373 p2_hpPalkki.BindTo(p2_hp); … … 367 388 p2_ammo_label.BindTo(p2_ammo); 368 389 p2_ammo_lipas.Y = Screen.Top - 50; 369 p2_ammo_lipas.X = + 100;390 p2_ammo_lipas.X = +60; 370 391 vali.Y = Screen.Top - 50; 371 vali.X = + 85;392 vali.X = +75; 372 393 p2_ammo_label.Y = Screen.Top - 50; 373 p2_ammo_label.X = + 60;394 p2_ammo_label.X = +100; 374 395 Add(p2_ammo_lipas); 375 396 Add(vali); … … 437 458 { 438 459 PhysicsObject ammus = ak2.Shoot(); 439 if (ammus != null) p 1_lipas.Value--;460 if (ammus != null) p2_lipas.Value--; 440 461 } 441 462 if (p1_lipas == 0) … … 445 466 Add(lataa); 446 467 } 447 if (multiplayer == 1 && p2_lipas == 0) 448 { 449 lataa2 = new Label("Reload"); 468 if (multiplayer == 0) return; 469 if (p2_lipas == 0) 470 { 471 lataa2 = new Label("Reload (X)"); 450 472 lataa2.X = -50; 451 lataa .MaximumLifetime = TimeSpan.FromSeconds(1);452 Add(lataa );473 lataa2.MaximumLifetime = TimeSpan.FromSeconds(1); 474 Add(lataa2); 453 475 } 454 476 } … … 457 479 if (kohde.Tag == "living") p1_hp.Value--; 458 480 if (p1_hp == 0) GameOver(); 481 if (multiplayer == 1 && p2_hp == 0) GameOver(); 459 482 } 460 483 void LuoAikaLaskuri() … … 526 549 ak1.Ammo.Value = p1_lipas.Value; 527 550 } 551 552 if (multiplayer == 1 && p2_ammo > 29 && p2_lipas == 0) 553 { 554 p2_ammo.Value -= 30; 555 p2_lipas.Value += 30; 556 ak2.Ammo.Value = p2_lipas.Value; 557 } 558 528 559 //if (p1_lipas == 0) 529 560 //{ … … 562 593 ClearAll(); 563 594 Mouse.IsCursorVisible = true; 564 HighScoreWindow topIkkuna = new HighScoreWindow("Parhaat pisteet","Onneksi olkoon, pääsit listalle lahtaamalla %p zombia! Syötä nimesi:", 565 topLista, killLaskuri); 595 HighScoreWindow topIkkuna = new HighScoreWindow("Parhaat pisteet", "Onneksi olkoon, pääsit listalle lahtaamalla %p zombia! Syötä nimesi:", topLista, killLaskuri); 566 596 topIkkuna.Closed += TallennaPisteet; 567 597 Add(topIkkuna); … … 569 599 void TallennaPisteet(Window sender) 570 600 { 571 DataStorage.Save<ScoreList>(topLista, " pisteet.xml");601 DataStorage.Save<ScoreList>(topLista, "scores.xml"); 572 602 Valikko(); 573 603 } -
2012/26/MikaL/Zombie Survival/Zombie Survival/Zombie SurvivalContent/Zombie SurvivalContent.contentproj
r3379 r3397 47 47 <Compile Include="fullbar.png"> 48 48 <Name>fullbar</Name> 49 <Importer>TextureImporter</Importer>50 <Processor>TextureProcessor</Processor>51 </Compile>52 <Compile Include="upbar.png">53 <Name>upbar</Name>54 49 <Importer>TextureImporter</Importer> 55 50 <Processor>TextureProcessor</Processor>
Note: See TracChangeset
for help on using the changeset viewer.