- Timestamp:
- 2012-06-15 12:29:03 (11 years ago)
- Location:
- 2012/24/LauriK/Call of Garden Tomato oppression
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
2012/24/LauriK/Call of Garden Tomato oppression/Call of Garden Tomato oppression/Call of Garden Tomato oppression/Call of Garden Tomato oppression.csproj.Debug.cachefile
r3061 r3132 25 25 Content\Lipas2.xnb 26 26 Content\teema.xnb 27 Content\AsRifle.xnb 28 Content\Raha.xnb 29 Content\Piikkilanka.xnb 30 Content\kentta2.xnb 27 31 Content\pullava.wma 28 32 Content\derp.wma … … 32 36 Content\warning.wma 33 37 Content\teema.wma 38 Content\kentta2.txt 34 39 Content\kentta1.txt 35 40 kentta1.txt -
2012/24/LauriK/Call of Garden Tomato oppression/Call of Garden Tomato oppression/Call of Garden Tomato oppression/Call_of_Garden_Tomato_oppression.cs
r3061 r3132 13 13 const int RUUDUN_KOKO = 40; 14 14 int kenttaNro = 0; 15 16 Label otsikko; 15 17 16 18 IntMeter pisteLaskuri; 17 19 18 public bool pelaajallaOnAse = true;19 20 public bool IntelKeratty = false; 21 public bool pelaajallaOnAse = false; 22 public bool vihuEiAmmu = false; 20 23 21 24 string cheat1 = "MaxAmmo"; … … 28 31 29 32 Image ValikkoTaustaKuva = LoadImage("city"); 33 30 34 Image kansio = LoadImage("kansio"); 35 31 36 Image lippaanKuva = LoadImage("Lipas2"); 37 38 Image aseenKuva = LoadImage("AsRifle"); 39 40 Image rahanKuva = LoadImage("Raha"); 41 42 Image piikkiKuva = LoadImage("Piikkilanka"); 32 43 33 44 Image paikallaanOikealle = LoadImage("Porkkana"); … … 61 72 ClearAll(); 62 73 63 MultiSelectWindow valikko = new MultiSelectWindow(" Call of Garden: Tomato Oppression",74 MultiSelectWindow valikko = new MultiSelectWindow("", 64 75 "Start Game", "Highscores", "Controls", "Exit"); 65 76 valikko.ItemSelected += PainettiinValikonNappia; … … 70 81 valikko.SelectionColor = Color.LimeGreen; 71 82 83 otsikko = new Label(5000, 5000); 84 otsikko.Text = "Call of Garden: Tomato Oppression"; 85 otsikko.TextColor = Color.Ruby; 86 //otsikko.X = Screen.Center; 87 otsikko.Y = valikko.Y + 200; 88 otsikko.Font = Font.DefaultLargeBold; 89 Add(otsikko); 90 72 91 MessageDisplay.BackgroundColor = Color.Transparent; 73 92 MessageDisplay.TextColor = Color.Ruby; … … 88 107 MediaPlayer.Pause(); 89 108 MediaPlayer.IsRepeating = false; 109 110 otsikko.Destroy(); 90 111 91 112 Gravity = new Vector(0, -1000); … … 100 121 tomaatinKuvaPeilattu = Image.Mirror(tomaatinKuva); 101 122 102 luoKentta("kentta_testi"); 123 if (kenttaNro == 1) 124 { 125 luoKentta("kentta2"); 126 } 127 128 else if (kenttaNro == 2) 129 { 130 luoKentta2("kentta2"); 131 } 103 132 104 133 Camera.Follow(porkkana); … … 111 140 if (kenttaNro == 0) valikko(); 112 141 else if (kenttaNro == 1) AloitaPeli(); 113 //else if (kenttaNro == 2) LuoKentta("kentta2.txt");142 else if (kenttaNro == 2) AloitaPeli(); 114 143 //else if (kenttaNro == 3) LuoKentta("kentta3.txt"); 115 else if (kenttaNro == 2) LopetaPeli();144 else if (kenttaNro == 3) LopetaPeli(); 116 145 } 117 146 … … 127 156 ruudut.SetTileMethod('L', luoLipas); 128 157 ruudut.SetTileMethod('M', luoMaali); 158 ruudut.SetTileMethod('A', AseMaassa); 159 ruudut.SetTileMethod('R', luoRaha); 160 ruudut.SetTileMethod('p', luoPiikkiLanka); 129 161 ruudut.Execute(20, 20); 130 162 … … 150 182 } 151 183 184 void luoKentta2(string levelFile) 185 { 186 TileMap ruudut = TileMap.FromLevelAsset(levelFile); 187 188 ruudut.SetTileMethod('P', lisaaPelaaja); 189 ruudut.SetTileMethod('T', lisaaTomaatti); 190 ruudut.SetTileMethod('-', lisaaTaso); 191 ruudut.SetTileMethod('_', lisaaTaso2); 192 ruudut.SetTileMethod('I', lisaaIntel); 193 ruudut.SetTileMethod('L', luoLipas); 194 ruudut.SetTileMethod('M', luoMaali); 195 ruudut.SetTileMethod('A', AseMaassa); 196 ruudut.SetTileMethod('R', luoRaha); 197 ruudut.SetTileMethod('p', luoPiikkiLanka); 198 ruudut.Execute(20, 20); 199 200 //Level.Background.Destroy(); 201 Level.CreateBorders(); 202 luoPisteLaskuri(); 203 luoVoimaMittari(); 204 lisaaNappaimet(); 205 206 Level.Background.Image = ValikkoTaustaKuva; 207 //Level.Background.Width = Screen.Width; 208 //Level.Background.Height = Screen.Height; 209 //Level.Background.Position = Screen.Center; 210 Level.Background.MovesWithCamera = false; 211 //GameObject taustaKuva = new GameObject(Screen.Width, Screen.Height); 212 //taustaKuva.Image = ValikkoTaustaKuva; 213 //taustaKuva.TextureFillsShape = true; 214 ////taustaKuva.Image.Height = Screen.Height; 215 //Add(taustaKuva, -3); 216 //Layers[-3].RelativeTransition = new Vector(0.5, 0.5); 217 218 Gravity = new Vector(0, -1000); 219 } 220 152 221 void lisaaTaso(Vector paikka, double leveys, double korkeus) 153 222 { … … 167 236 porkkana.Position = paikka; 168 237 169 if (pelaajallaOnAse == true)170 {171 porkkana.Weapon = new AssaultRifle(10, 5);172 porkkana.Weapon.Ammo.Value = 10;173 //porkkana.Weapon.Position = paikka;174 //porkkana.Weapon.X = porkkana.X + 5;175 LuoAmmusLaskin();176 }177 178 238 porkkana.IgnoresExplosions = true; 179 AddCollisionHandler<PhysicsObject, PhysicsObject>(porkkana, "lipas", delegate180 {181 porkkana.Weapon.Ammo.Value += 10;182 MessageDisplay.Add("You picked up 10 ammo!");183 184 });185 186 AddCollisionHandler (porkkana, "lipas", CollisionHandler.DestroyTarget);187 239 188 240 porkkana.Tag = "Porkkana"; … … 217 269 tomaatti.Brain = seuraajanAivot; 218 270 seuraajanAivot.Target = porkkana; 219 seuraajanAivot.Speed = 150;271 seuraajanAivot.Speed = 200; 220 272 seuraajanAivot.TargetFollowDistance = 300; 221 seuraajanAivot.FollowAlways = false;273 seuraajanAivot.FollowAlways = true; 222 274 seuraajanAivot.Active = false; 275 seuraajanAivot.TargetCloseDistance = 200; 276 seuraajanAivot.StopWhenTargetClose = false; 223 277 224 278 RandomMoverBrain randomAivot = new RandomMoverBrain(); … … 295 349 if (tomaatti.FacingDirection != porkkana.FacingDirection) 296 350 { 297 seuraajanAivot.Active = true; 298 randomAivot.Active = false; 299 MediaPlayer.Play("Warning"); 300 MediaPlayer.IsRepeating = true; 301 VihuAmpuu(tomaatti); 351 if (vihuEiAmmu == false) 352 { 353 seuraajanAivot.Active = true; 354 randomAivot.Active = false; 355 MediaPlayer.Play("Warning"); 356 MediaPlayer.IsRepeating = true; 357 VihuAmpuu(tomaatti); 358 } 302 359 } 303 360 } … … 318 375 { 319 376 tomaatinElamat(tomaatti, nakokentta, 5, tomaattiMittari); 320 pisteLaskuri.Value += 1 ;377 pisteLaskuri.Value += 10; 321 378 } 322 379 ); … … 326 383 Keyboard.Listen(Key.Q, ButtonState.Pressed, delegate 327 384 { 328 if(tomaatti.FacingDirection == porkkana.FacingDirection && tomaatti.X-porkkana.X < 50 && tomaatti.X-porkkana.X > -50)385 if(tomaatti.FacingDirection == porkkana.FacingDirection && tomaatti.X-porkkana.X < 10 && tomaatti.X-porkkana.X > -10) 329 386 { 330 387 tomaatinElamat(tomaatti, nakokentta, 100, tomaattiMittari); … … 335 392 } 336 393 337 else if (tomaatti.FacingDirection != porkkana.FacingDirection && tomaatti.X - porkkana.X < 50 && tomaatti.X - porkkana.X > -50)394 else if (tomaatti.FacingDirection != porkkana.FacingDirection && tomaatti.X - porkkana.X < 10 && tomaatti.X - porkkana.X > -10) 338 395 { 339 396 tomaatinElamat(tomaatti, nakokentta, 10, tomaattiMittari); … … 425 482 void ammuAseella() 426 483 { 484 if (pelaajallaOnAse == true) 485 { 486 427 487 PhysicsObject ammus = porkkana.Weapon.Shoot(); 428 488 … … 430 490 { 431 491 ammus.Tag = "ammus"; 432 ammus.Size *= 0. 1;433 ammus.Restitution = 0. 1;492 ammus.Size *= 0.5; 493 ammus.Restitution = 0.9; 434 494 ammus.MaximumLifetime = TimeSpan.FromSeconds(5); 435 495 } 436 } 437 496 } 497 } 498 438 499 void TahtaaYlos() 439 500 { 440 if (porkkana.FacingDirection == Direction.Right) 441 { 442 porkkana.Weapon.Angle += Angle.FromDegrees(5); 443 } 444 if (porkkana.FacingDirection == Direction.Left) 445 { 446 porkkana.Weapon.Angle += Angle.FromDegrees(-5); 501 if (pelaajallaOnAse == true) 502 { 503 if (porkkana.FacingDirection == Direction.Right) 504 { 505 porkkana.Weapon.Angle += Angle.FromDegrees(5); 506 } 507 if (porkkana.FacingDirection == Direction.Left) 508 { 509 porkkana.Weapon.Angle += Angle.FromDegrees(-5); 510 } 447 511 } 448 512 } … … 450 514 void TahtaaAlas() 451 515 { 452 if (porkkana.FacingDirection == Direction.Right) 453 { 454 porkkana.Weapon.Angle += Angle.FromDegrees(-5); 455 } 456 if (porkkana.FacingDirection == Direction.Left) 457 { 458 porkkana.Weapon.Angle += Angle.FromDegrees(5); 516 if (pelaajallaOnAse == true) 517 { 518 if (porkkana.FacingDirection == Direction.Right) 519 { 520 porkkana.Weapon.Angle += Angle.FromDegrees(-5); 521 } 522 if (porkkana.FacingDirection == Direction.Left) 523 { 524 porkkana.Weapon.Angle += Angle.FromDegrees(5); 525 } 459 526 } 460 527 } … … 469 536 void musiikkiIkkuna() 470 537 { 471 MultiSelectWindow cheatvalikko = new MultiSelectWindow("Choose song", "Pullava-song",538 MultiSelectWindow musiikkivalikko = new MultiSelectWindow("Choose song", "Pullava-song", 472 539 "Derp-song", "Super Mario- song", "Simpsons theme song", "Ghostbusters theme song", "Spy theme song", "Pause current song"); 473 cheatvalikko.ItemSelected += PainettiinMusiikkiValikonNappia;474 Add( cheatvalikko);540 musiikkivalikko.ItemSelected += PainettiinMusiikkiValikonNappia; 541 Add(musiikkivalikko); 475 542 } 476 543 … … 481 548 if (vastaus == cheat1) 482 549 { 483 porkkana.Weapon.Ammo.Value = 100; 550 if (pelaajallaOnAse == true) 551 { 552 porkkana.Weapon.Ammo.Value = 100; 553 } 484 554 } 485 555 } … … 570 640 { 571 641 Timer ajastin = new Timer(); 572 ajastin.Interval = 1;642 ajastin.Interval = 0.01; 573 643 ajastin.Timeout += delegate 574 644 { 645 if (vihuEiAmmu == false) 646 { 575 647 Vector suunta = (porkkana.Position - pahis.Position).Normalize(); 576 648 pahis.Angle = suunta.Angle; 577 649 578 650 PhysicsObject VihuAmmus = pahis.Weapon.Shoot(); 579 651 … … 582 654 if (VihuAmmus != null) 583 655 { 584 VihuAmmus.Size *= 0. 1;656 VihuAmmus.Size *= 0.5; 585 657 VihuAmmus.Restitution = 0.1; 586 658 VihuAmmus.MaximumLifetime = TimeSpan.FromSeconds(5); 587 659 } 660 } 588 661 }; 589 662 ajastin.Start(); … … 661 734 void LopetaPeli() 662 735 { 736 MediaPlayer.Stop(); 737 738 vihuEiAmmu = true; 739 663 740 MediaPlayer.Play("teema"); 664 741 665 742 HighScoreWindow topIkkuna = new HighScoreWindow( 666 743 "Highscores", 667 "Congratulations, you got a highscore %p!Enter your name:",744 "Congratulations, you got a highscore: %p!\n Enter your name:", 668 745 topLista, pisteLaskuri.Value); 669 746 topIkkuna.Closed += TallennaPisteet; … … 719 796 { 720 797 PhysicsObject maali = new PhysicsObject(leveys, korkeus); 721 maali.Color = Color. Gold;798 maali.Color = Color.Transparent; 722 799 maali.Mass = 4; 723 800 maali.Position = paikka; 801 maali.IgnoresCollisionResponse = true; 802 maali.IgnoresGravity = true; 724 803 725 804 Add(maali); … … 729 808 if (IntelKeratty == true) 730 809 { 810 pisteLaskuri.Value += 500; 731 811 kenttaNro++; 732 812 seuraavaKentta(kenttaNro); … … 736 816 } 737 817 818 void AseMaassa(Vector paikka, double leveys, double korkeus) 819 { 820 PhysicsObject ase = new PhysicsObject(aseenKuva); 821 ase.Position = paikka; 822 Add(ase); 823 824 AddCollisionHandler(ase, porkkana, delegate 825 { 826 pelaajaSaiAseen(); 827 pisteLaskuri.Value += 50; 828 ase.Destroy(); 829 }); 830 } 831 832 void pelaajaSaiAseen() 833 { 834 porkkana.Weapon = new AssaultRifle(10, 5); 835 //porkkana.Weapon.Position = paikka; 836 //porkkana.Weapon.X = porkkana.X + 5; 837 porkkana.Weapon.Ammo.Value = 0; 838 porkkana.Weapon.Ammo.Value += 20; 839 LuoAmmusLaskin(); 840 pelaajallaOnAse = true; 841 842 AddCollisionHandler<PhysicsObject, PhysicsObject>(porkkana, "lipas", delegate 843 { 844 porkkana.Weapon.Ammo.Value += 10; 845 pisteLaskuri.Value += 50; 846 MessageDisplay.Add("You picked up 10 ammo!"); 847 848 }); 849 850 AddCollisionHandler(porkkana, "lipas", CollisionHandler.DestroyTarget); 851 } 852 853 void luoRaha(Vector paikka, double korkeus, double leveys) 854 { 855 PhysicsObject raha = new PhysicsObject(10, 10); 856 raha.Image = rahanKuva; 857 raha.Position = paikka; 858 Add(raha); 859 860 AddCollisionHandler(raha, porkkana, delegate 861 { 862 pisteLaskuri.Value += 100; 863 }); 864 865 AddCollisionHandler(raha, porkkana, CollisionHandler.DestroyObject); 866 } 867 868 void luoPiikkiLanka(Vector paikka, double korkeus, double leveys) 869 { 870 PhysicsObject piikkiLanka = new PhysicsObject(korkeus, leveys); 871 piikkiLanka.Image = piikkiKuva; 872 piikkiLanka.Position = paikka; 873 piikkiLanka.Mass = 2000000; 874 Add(piikkiLanka); 875 876 AddCollisionHandler(piikkiLanka, porkkana, delegate 877 { 878 voimaMittari.Value -= 25; 879 }); 880 } 738 881 739 882 } -
2012/24/LauriK/Call of Garden Tomato oppression/Call of Garden Tomato oppression/Call of Garden Tomato oppressionContent/Call of Garden Tomato oppressionContent.contentproj
r3061 r3132 215 215 </Compile> 216 216 </ItemGroup> 217 <ItemGroup> 218 <Compile Include="AsRifle.png"> 219 <Name>AsRifle</Name> 220 <Importer>TextureImporter</Importer> 221 <Processor>TextureProcessor</Processor> 222 </Compile> 223 </ItemGroup> 224 <ItemGroup> 225 <Compile Include="Raha.png"> 226 <Name>Raha</Name> 227 <Importer>TextureImporter</Importer> 228 <Processor>TextureProcessor</Processor> 229 </Compile> 230 </ItemGroup> 231 <ItemGroup> 232 <Compile Include="Piikkilanka.png"> 233 <Name>Piikkilanka</Name> 234 <Importer>TextureImporter</Importer> 235 <Processor>TextureProcessor</Processor> 236 </Compile> 237 </ItemGroup> 238 <ItemGroup> 239 <Compile Include="kentta2.txt"> 240 <Name>kentta2</Name> 241 <Importer>TextFileImporter</Importer> 242 <Processor>TextFileContentProcessor</Processor> 243 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 244 </Compile> 245 </ItemGroup> 217 246 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 218 247 <!-- To modify your build process, add your task inside one of the targets below and uncomment it. -
2012/24/LauriK/Call of Garden Tomato oppression/Call of Garden Tomato oppression/Call of Garden Tomato oppressionContent/kentta1.txt
r3061 r3132 4 4 5 5 6 ---------------- ---6 ---------------- -- 7 7 ---- - 8 ---- T I T-8 ----- T I - 9 9 --------- _ T ---- ------------ 10 10 - - - ___T - - - - 11 - P M L --- - _____T -T --- T T --11 - P M L --- - p _____ - --- T - - -- 12 12 ---------______________________________---------- -
2012/24/LauriK/Call of Garden Tomato oppression/Call of Garden Tomato oppression/Call of Garden Tomato oppressionContent/kentta_testi.txt
r3061 r3132 14 14 15 15 16 L P IM16 L P A R I p M 17 17 ------------------ 18 T T18 T 19 19 -------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.