Changeset 7234
- Timestamp:
- 2016-06-10 12:12:27 (7 years ago)
- Location:
- 2015/23/HenriK/dungeoncrawlar
- Files:
-
- 114 added
- 12 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2015/23/HenriK/dungeoncrawlar/dungeoncrawlar/dungeoncrawlar/dungeoncrawlar.cs
r5894 r7234 6 6 using Jypeli.Effects; 7 7 using Jypeli.Widgets; 8 8 9 class Pelihahmo : PhysicsObject 9 10 { … … 21 22 public class dungeoncrawlar : PhysicsGame 22 23 { 23 PhysicsObject ovi; 24 EasyHighScore ennätys = new EasyHighScore(); 25 24 26 Pelihahmo player; 25 27 PhysicsObject ammus; … … 32 34 33 35 Listener aseNyt; 34 Image[] lattiatext = LoadImages("blackwhitegorund bloody1", "blackwhitegorund bloody2", "blackwhiteground"); 36 Image[] lattiatext = LoadImages("stooones mang", "stooones mang2", "stooones mang3"); 37 Image[] NRGpellet = LoadImages("NRGpellet1", "NRGpellet2", "NRGpellet3", "NRGpellet4","NRGpellet5","NRGpellet5.5","NRGpellet6","NRGpellet6"); 35 38 Image[] lattiakolo = LoadImages("blackwhitegroundhole1.", "blackwhitegroundhole2", "blackwhitegroundhole2 - Copy", "blackwhitegroundhole3", "blackwhitegroundhole3 - copy", "blackwhitegroundhole4", "blackwhitegroundhole4 - copy"); 36 Image[] ruumisvihu = LoadImages("zombi1","zombi2","zombi3", "zombi4", "zombi5", "zombi6", "zombi7"); 37 39 Image ruumisvihu = LoadImage("lizerded"); 40 41 int taso= 1; 42 int pisteet = 0; 38 43 int avaintenLkm; 39 44 int l96 = 0; 40 45 int elämät = 100; 46 int lisko = 0; 41 47 42 48 int nog = 0; 49 50 51 PhysicsObject[] palat; 52 Image dead_dragon = LoadImage("dedragon"); 53 Image dead_dragonbod = LoadImage("dedragon bod"); 54 Image paaKuva = LoadImage("weedragon hed"); 55 56 Image hantaKuva = LoadImage("weedragon"); 57 Image hantaKuvaFlip; 58 Image paaKuvaFlip; 59 Image dead_dragonFlip; 43 60 44 45 46 47 61 48 62 public override void Begin() 49 63 { 64 player = new Pelihahmo(45, 50, elämät + nog, 100 + nog); 65 hantaKuvaFlip = Image.Flip(hantaKuva); 66 paaKuvaFlip = Image.Flip(paaKuva); 67 50 68 SmoothTextures = false; 51 69 luohuone(1); 70 IsFullScreen = false; 52 71 53 72 … … 86 105 Add(ruumis, -1); 87 106 ruumis.MaximumLifetime = TimeSpan.FromSeconds(200); 88 ruumis.Animation = new Animation(ruumisvihu); 89 ruumis.Animation.FPS = 7; 90 ruumis.Animation.Start(); 107 108 109 } 110 void luoPelaajaRuumis(Vector paikka, Image kuva,Angle kulma) 111 { 112 GameObject ruumis = new GameObject(50, 55); 113 ruumis.Image = kuva; 114 ruumis.Position = paikka; 115 ruumis.Angle = kulma; 116 Add(ruumis, -1); 91 117 } 92 118 void lepakko(Vector paikka, double leveys, double korkeus) … … 149 175 void Vihu(Vector paikka, double leveys, double korkeus) 150 176 { 177 lisko++; 151 178 arvotext(paikka, leveys, korkeus); 152 Pelihahmo vihu = new Pelihahmo( 50, 50, 20, 20);179 Pelihahmo vihu = new Pelihahmo(60, 40, 20, 20); 153 180 vihu.Position = paikka; 154 181 vihu.LinearDamping = 0.5; 155 182 Add(vihu); 156 157 158 159 Image c = LoadImage("zombi"); 183 vihu.CollisionIgnoreGroup = 4; 184 185 186 187 Image[] Lizerd = LoadImages("lizerd1", "lizerd2", "lizerd4", "lizerd3"); 160 188 //vihu.Shape = Shape.FromImage(c); 161 vihu.Image = c; 162 vihu.ElamaLaskuri.LowerLimit += delegate 163 164 { 189 190 vihu.Animation = new Animation(Lizerd); 191 vihu.Animation.FPS = 7; 192 vihu.Animation.Start(); 193 194 vihu.ElamaLaskuri.LowerLimit += delegate 195 { 196 pisteet = pisteet + 100; 165 197 vihu.Destroy(); 166 luoruumis(vihu.Position, ruumisvihu[0]); 198 luoruumis(vihu.Position, ruumisvihu); 199 lisko--; 200 MessageDisplay.Add("liskoja jäljellä:" + lisko); 201 player.ElamaLaskuri.Value += 4; 167 202 }; 168 203 … … 182 217 { 183 218 GameObject väistä = null; 184 double väistöEtäisyys = 10;219 double väistöEtäisyys = 40; 185 220 foreach (GameObject ammus in GetObjectsWithTag("ammus")) 186 221 { … … 205 240 ajastin.Start(); 206 241 } 242 void bossi(Vector paikka, double leveys, double korkeus) 243 { 244 arvotext(paikka, leveys, korkeus); 245 Image Liz_King = LoadImage("liz king"); 246 Pelihahmo pääVihu = new Pelihahmo(700, 400, 20000, 20000); 247 pääVihu.Position = paikka; 248 pääVihu.Shape = Shape.FromImage(Liz_King); 249 pääVihu.LinearDamping = 0.8; 250 Add(pääVihu); 251 pääVihu.CollisionIgnoreGroup = 4; 252 pääVihu.Tag = "vihu"; 253 254 Timer bossiajastin = new Timer(); 255 bossiajastin.Interval = 3; 256 bossiajastin.Timeout += () => bossiattackrotate(pääVihu); 257 bossiajastin.Start(); 258 259 260 261 ProgressBar elamaPalkki = new ProgressBar(800, 30); 262 elamaPalkki.X = 0; 263 elamaPalkki.Y = Window.Height / 2 - 100; 264 265 elamaPalkki.BindTo(pääVihu.ElamaLaskuri); 266 Add(elamaPalkki); 267 268 pääVihu.Image = Liz_King; 269 pääVihu.ElamaLaskuri.LowerLimit += delegate 270 { 271 pisteet = pisteet + 10000; 272 pääVihu.Destroy(); 273 luoruumis(pääVihu.Position, ruumisvihu); 274 lisko--; 275 MessageDisplay.Add("tapoit pää bossin"); 276 bossiajastin.Stop(); 277 LisaaPorrasYlos(pääVihu.Position, 100, 100); 278 }; 279 } 280 void bossiattackrotate(Pelihahmo vihu) 281 { 282 283 RandomGen.SelectOne(new Action[] { () => bossishoot(vihu), () => bossislam(vihu), () => bossispawn(vihu.Position) })(); 284 } 285 void bossishoot(Pelihahmo vihu) 286 { 287 for (int i = 0; i <= 5; i++ ) 288 { 289 290 PhysicsObject homAmmus = new PhysicsObject(10, 10); 291 homAmmus.IgnoresCollisionResponse = true; 292 homAmmus.Position = vihu.Position; 293 homAmmus.Animation = new Animation(NRGpellet); 294 homAmmus.Animation.FPS = 7; 295 homAmmus.Animation.Start(); 296 homAmmus.Angle = vihu.Angle * 5 * i; 297 298 299 Add(homAmmus); 300 homAmmus.MaximumLifetime = new TimeSpan(100000000); 301 homAmmus.Push(homAmmus.Angle.GetVector() * 100000 ); 302 FollowerBrain aivo = new FollowerBrain(player); 303 aivo.Speed = 200; 304 homAmmus.Brain = aivo; 305 homAmmus.Tag = "vihu"; 306 AddCollisionHandler(homAmmus, "player", delegate(PhysicsObject a, PhysicsObject b) 307 { 308 vahinko(a, b, 10); 309 }); 310 } 311 } 312 void bossislam(Pelihahmo vihu) 313 { 314 int ammuksia = 60; 315 316 for (int i = 0; i <= ammuksia; i++) 317 { 318 PhysicsObject ammus2 = new PhysicsObject(10, 10); 319 320 ammus2.IgnoresCollisionResponse = true; 321 ammus2.Position = vihu.Position; 322 ammus2.Animation = new Animation(NRGpellet); 323 ammus2.Animation.FPS = 7; 324 ammus2.Animation.Start(); 325 ammus2.Angle = Angle.FromDegrees(360 * i/(double)ammuksia); 326 327 Add(ammus2); 328 ammus2.MaximumLifetime = TimeSpan.FromSeconds(3); 329 ammus2.Push(ammus2.Angle.GetVector() * 10000); 330 331 ammus2.Tag = "vihu"; 332 AddCollisionHandler(ammus2, "player", delegate(PhysicsObject a, PhysicsObject b) 333 { 334 vahinko(a, b, 10); 335 }); 336 } 337 } 338 void bossispawn(Vector paikka) 339 { 340 Vihu(paikka, 60, 40); 341 } 342 207 343 208 344 void aseet() 209 345 { 210 346 211 if (l96 > 0) 212 { 213 Keyboard.Listen(Key.D1, ButtonState.Pressed, aseenVaihto, "aseen vaihto", 1); 214 } 215 216 217 218 Keyboard.Listen(Key.D3, ButtonState.Pressed, aseenVaihto, "aseen vaihto", 2); 347 348 349 350 Keyboard.Listen(Key.Enter, ButtonState.Down, ammupistol, "pum pum"); 351 352 /*Keyboard.Listen(Key.D3, ButtonState.Pressed, aseenVaihto, "aseen vaihto", 2); 219 353 Keyboard.Listen(Key.D4, ButtonState.Pressed, aseenVaihto, "aseen vaihto", 3); 220 Keyboard.Listen(Key.Space, ButtonState.Pressed, lyö, "aseen vaihto"); 354 Keyboard.Listen(Key.Space, ButtonState.Pressed, lyö, "aseen vaihto");*/ 221 355 222 356 … … 225 359 void aseenVaihto(int ase) 226 360 { 227 if (aseNyt != null)361 /*if (aseNyt != null) 228 362 { 229 363 aseNyt.Destroy(); 230 } 231 232 switch (ase)364 }*/ 365 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, ammupistol, "pum pum"); 366 /*switch (ase) 233 367 { 234 368 case 1: … … 241 375 aseNyt = Mouse.Listen(MouseButton.Left, ButtonState.Pressed, ammupistol, "pum pum"); 242 376 break; 243 } 377 } */ 244 378 } 245 379 void block() … … 260 394 261 395 //ammus.Hit(impulssi); 262 ammus.MaximumLifetime = new TimeSpan( 20000);396 ammus.MaximumLifetime = new TimeSpan(10000); 263 397 264 398 } … … 289 423 290 424 } 291 void ammu ()292 { 293 294 Image c = LoadImage("characterl96");295 player.Shape = Shape.FromImage( c);296 player.Image = c;297 298 299 300 ammus = new PhysicsObject( 5.0, 5.0);425 void ammupistol() 426 { 427 428 Image i = LoadImage("thecharacterpistol"); 429 player.Shape = Shape.FromImage(i); 430 player.Image = i; 431 432 433 434 ammus = new PhysicsObject(30.0, 10.0); 301 435 ammus.Shape = Shape.Circle; 302 436 ammus.Color = Color.Gold; 303 437 ammus.Position = player.Position; 304 438 ammus.CollisionIgnoreGroup = 1; 439 ammus.CollisionIgnoreGroup = 5; 305 440 Image d = LoadImage("bullet"); 306 441 ammus.Shape = Shape.FromImage(d); … … 310 445 Add(ammus); 311 446 312 Vector impulssi = Vector.FromLengthAndAngle( 2500, player.Angle);447 Vector impulssi = Vector.FromLengthAndAngle(1000 + player.Velocity.Magnitude, player.Angle); 313 448 ammus.Hit(impulssi); 314 ammus.MaximumLifetime = new TimeSpan(20000000); 315 316 AddCollisionHandler(ammus, "vihu", delegate(PhysicsObject a, PhysicsObject b) 317 { 318 vahinko(a, b, 20); 319 }); 320 321 322 } 323 void ammupistol() 324 { 325 326 Image i = LoadImage("thecharacterpistol"); 327 player.Shape = Shape.FromImage(i); 328 player.Image = i; 329 330 331 332 ammus = new PhysicsObject(10.0, 10.0); 333 ammus.Shape = Shape.Circle; 334 ammus.Color = Color.Gold; 335 ammus.Position = player.Position; 336 ammus.CollisionIgnoreGroup = 1; 337 Image d = LoadImage("bullet"); 338 ammus.Shape = Shape.FromImage(d); 339 ammus.Image = d; 340 ammus.Angle = player.Angle; 341 ammus.Tag = "ammus"; 342 Add(ammus); 343 344 Vector impulssi = Vector.FromLengthAndAngle(2500, player.Angle); 345 ammus.Hit(impulssi); 346 ammus.MaximumLifetime = new TimeSpan(20000000); 449 450 ammus.MaximumLifetime = new TimeSpan(1000000); 347 451 AddCollisionHandler(ammus, "vihu", delegate(PhysicsObject a, PhysicsObject b) 348 452 { … … 372 476 void luohuone(int huoneNumero) 373 477 { 374 Window.Width = 800; 375 Window.Height = 800; 478 Window.Width = 2048; 479 Window.Height = 1024; 480 Window.Top = 0; 376 481 Camera.Zoom(0.5); 377 482 … … 383 488 384 489 385 TileMap ruudut = TileMap.FromLevelAsset("huone" + huoneNumero);490 /*TileMap ruudut = TileMap.FromLevelAsset("huone" + huoneNumero); 386 491 TileMap ruudut2 = TileMap.FromLevelAsset("huone" + huoneNumero); 387 492 … … 404 509 ruudut.SetTileMethod('a', LuoAse96); 405 510 ruudut.SetTileMethod('j', luoJuggernog); 406 /*ruudut.SetTileMethod('z', Luokolo5);511 ruudut.SetTileMethod('z', Luokolo5); 407 512 ruudut.SetTileMethod('b', Luokolo2); 408 513 ruudut.SetTileMethod('g', Luokolo3); 409 514 ruudut.SetTileMethod('t', Luokolo4); 410 ruudut.SetTileMethod('r', Luokolo1); */515 ruudut.SetTileMethod('r', Luokolo1); 411 516 412 517 … … 418 523 ruudut2.SetTileMethod('l', lepakko); 419 524 ruudut.Execute(64, 64); 420 ruudut2.Execute(64, 64); 421 422 423 424 Camera.StayInLevel = true; 525 ruudut2.Execute(64, 64);*/ 526 ClearAll(); 527 528 TileMap test; 529 if (taso % 5 == 0) 530 { 531 LuolaGeneraattori gen = new LuolaGeneraattori((string derp) => { }); 532 gen.CreateDungeon(60, 40, features: 200, chests: 15); 533 var tiles = gen.GetDungeon(); 534 test = new TileMap(tiles); 535 } 536 else 537 test = TileMap.FromLevelAsset("boss"); 538 539 540 test.SetTileMethod('S', LisaaSeina); 541 test.SetTileMethod('|', LisaaSeina); 542 test.SetTileMethod('.', LisaaSeina); 543 test.SetTileMethod('b', bossi); 544 test.SetTileMethod('_', LisaaLattia); 545 test.SetTileMethod('#', LisaaLattia); 546 test.SetTileMethod('+', LisaaPorrasYlos); 547 test.SetTileMethod('-', LisaaPorrasAlas); 548 test.SetTileMethod('-', LuoPelaaja); 549 test.SetTileMethod('D', LisaaLattia); 550 test.SetTileMethod('C', LisaaArkku); 551 test.Execute(100, 100); 552 553 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 554 555 //Keyboard.Listen(Key.Space, ButtonState.Pressed, Begin, null); 556 Camera.StayInLevel = true; 425 557 näppäimet(); 426 558 aseet(); 427 559 avaintenLkm = 0; 428 429 430 431 432 } 433 560 561 } 562 563 void LisaaSeina(Vector paikka, double leveys, double korkeus) 564 { 565 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 566 taso.Position = paikka; 567 taso.Color = Color.Black; 568 Add(taso); 569 } 570 571 void LisaaLattia(Vector paikka, double leveys, double korkeus) 572 { 573 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 574 taso.Position = paikka; 575 Image tasoKuva = arvotext(paikka, leveys, korkeus); 576 taso.Image = tasoKuva; 577 taso.IgnoresCollisionResponse = true; 578 579 Add(taso, -3); 580 } 581 582 void LisaaPorrasAlas(Vector paikka, double leveys, double korkeus) 583 { 584 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 585 taso.Position = paikka; 586 taso.Color = Color.Red; 587 588 589 Add(taso, 6); 590 591 592 } 593 594 void LisaaPorrasYlos(Vector paikka, double leveys, double korkeus) 595 { 596 PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 597 taso.Position = paikka; 598 taso.Color = Color.Blue; 599 taso.Tag = "porrasA"; 600 Add(taso); 601 } 602 603 void LisaaArkku(Vector paikka, double leveys, double korkeus) 604 { 605 if (RandomGen.NextDouble(0, 100) < 50) 606 { 607 PhysicsObject arkku = new PhysicsObject(leveys, korkeus); 608 arkku.Position = paikka; 609 arkku.Color = Color.Brown; 610 LisaaLattia(paikka, leveys, korkeus); 611 Add(arkku, 1); 612 } 613 else 614 { 615 Vihu(paikka, leveys, korkeus); 616 617 } 618 } 619 620 434 621 void AvaintenKerays(PhysicsObject tormaaja, PhysicsObject tormatty) 435 622 { … … 450 637 } 451 638 452 voidarvotext(Vector paikka, double leveys, double korkeus)639 Image arvotext(Vector paikka, double leveys, double korkeus) 453 640 { 454 641 GameObject taso = new GameObject(leveys, korkeus); 455 642 taso.Position = paikka; 456 643 //taso.CollisionIgnoreGroup = 1; 457 if (RandomGen.NextDouble(0, 100) < 95)644 if (RandomGen.NextDouble(0, 100) < 50) 458 645 { 459 646 taso.Image = lattiatext[2]; 647 return lattiatext[2]; 460 648 } 461 649 else … … 463 651 int x = RandomGen.NextInt(2); 464 652 taso.Image = lattiatext[x]; 653 return lattiatext[x]; 465 654 } 466 655 … … 500 689 //delegate(PhysicsObject a, PhysicsObject b) {kerays(a, b, "avain");} 501 690 } 502 void OvenAvaus(PhysicsObject tormaaja, PhysicsObject ovi) 503 { 504 if (Keyboard.GetKeyState(Key.E)==ButtonState.Down) 505 { 506 elämät = player.ElamaLaskuri.Value; 507 ClearAll(); 508 luohuone(RandomGen.NextInt(2, 6)); 509 510 691 void alasMeno(PhysicsObject tormaaja, PhysicsObject porrasA) 692 { 693 if(lisko == 0) 694 { 695 if (Keyboard.GetKeyState(Key.E) == ButtonState.Down) 696 { 697 elämät = player.ElamaLaskuri.Value; 698 pisteet = pisteet + 1000; 699 taso++; 700 /*if (taso == 5) 701 { 702 bossi; 703 }*/ 704 Begin(); 705 MessageDisplay.Add("pisteesi:" + pisteet); 706 MessageDisplay.Add("taso:" + taso); 707 708 } 709 710 711 511 712 } 512 713 } … … 514 715 { 515 716 arvotext(paikka, leveys, korkeus); 516 player = new Pelihahmo(45, 50, elämät +nog, 100 + nog);717 player.Position = paikka; 517 718 Image c = LoadImage("thecharacter"); 518 719 player.Shape = Shape.FromImage(c); 519 player.Image = c;720 player.Image = paaKuva; 520 721 player.ElamaLaskuri.LowerLimit += delegate 521 722 { 522 723 player.Destroy(); 523 luoruumis(player.Position, ruumisvihu[0]); 724 ennätys.EnterAndShow(pisteet); 725 726 ennätys.HighScoreWindow.Closed += (Window w) => Begin(); 727 luoPelaajaRuumis(player.Position, dead_dragon, player.Angle); 728 pisteet = 0; 729 for (int i = 0; i < palat.Length; i++) 730 { 731 palat[i].Destroy(); 732 luoPelaajaRuumis(palat[i].Position, dead_dragonbod, palat[i].Angle); 733 } 524 734 }; 525 735 … … 529 739 player.LinearDamping = 0.6; 530 740 player.AngularDamping = 0.6; 531 player.CollisionIgnoreGroup = 1; 741 player.CollisionIgnoreGroup = 1; 742 player.CollisionIgnoreGroup = 5; 532 743 533 744 player.MaxAngularVelocity = 8000.0; 534 745 player.Color = Color.Brown; 535 746 player.Mass = 1; 536 Add(player );747 Add(player, 3); 537 748 player.Tag="player"; 538 749 750 palat = new PhysicsObject[10]; 751 752 for (int i = 0; i < palat.Length; i++) 753 { 754 palat[i] = new PhysicsObject(60, 60); 755 palat[i].Image = paaKuva; 756 Add(palat[i]); 757 } 758 759 var ajastin = new Timer(); 760 ajastin.Interval = 0.01; 761 ajastin.Timeout += () => OhjaaPaloja(player, 40); 762 ajastin.Start(); 763 539 764 AddCollisionHandler(player, "avain", AvaintenKerays); 540 AddCollisionHandler(player, " ovi", OvenAvaus);765 AddCollisionHandler(player, "porrasA", alasMeno); 541 766 AddCollisionHandler(player, "l96wallbuy", PoimiAse); 542 767 AddCollisionHandler(player, "juggernog", PoimiNog); 543 768 //AddCollisionHandler(vihu, "player", zombinruokaa); 544 769 545 ProgressBar elamaPalkki = new ProgressBar( player.Width, player.Height* 0.25);546 elamaPalkki.X = player.X - 20;547 elamaPalkki.Y = player.Y;548 elamaPalkki.Angle = player.Angle + Angle.FromDegrees(90);770 ProgressBar elamaPalkki = new ProgressBar(200, 20); 771 elamaPalkki.X = 600; 772 elamaPalkki.Y = Window.Height / 2 - 100; 773 //elamaPalkki.Angle = player.Angle + Angle.FromDegrees(90); 549 774 elamaPalkki.BindTo(player.ElamaLaskuri); 550 player.Add(elamaPalkki);775 Add(elamaPalkki); 551 776 552 777 … … 559 784 Camera.Follow(player); 560 785 } 786 787 void OhjaaPaloja(GameObject ohjain, double palanKoko) 788 { 789 GameObject edeltava = ohjain; 790 player.Image = dead_dragon; 791 if ((player.Angle + Angle.FromDegrees(90)).GetPositiveDegrees() > 180) 792 { 793 player.Image = dead_dragonFlip; 794 } 795 player.Image = paaKuva; 796 if ((player.Angle + Angle.FromDegrees(90)).GetPositiveDegrees() > 180) 797 { 798 player.Image = paaKuvaFlip; 799 } 800 801 for (int i = 0; i < palat.Length; i++) 802 { 803 PhysicsObject pala = palat[i]; 804 pala.CollisionIgnoreGroup = 5; 805 pala.LinearDamping = 0.9; 806 // Palan sijainnin ja kulman päivitys. 807 Vector suunta = pala.Position - edeltava.Position; 808 if (suunta.Magnitude > palanKoko) 809 { 810 suunta = suunta.Normalize(); 811 pala.Position = edeltava.Position + suunta * palanKoko; 812 } 813 pala.Angle = suunta.Angle; 814 815 // Palan kuvan muuttaminen kulman suhteen. 816 pala.Image = hantaKuva; 817 if ((pala.Angle + Angle.FromDegrees(90)).GetPositiveDegrees() > 180) 818 { 819 pala.Image = hantaKuvaFlip; 820 } 821 822 edeltava = palat[i]; 823 } 824 } 825 561 826 void näppäimet() 562 827 { 563 //Keyboard.Listen(Key.W, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(1500, player.Angle));564 //Keyboard.Listen(Key.S, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(-500, player.Angle));565 //Keyboard.Listen(Key.D, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(-1000, player.Angle + Angle.FromDegrees(90)));566 //Keyboard.Listen(Key.A, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(1000, player.Angle + Angle.FromDegrees(90)));828 /*Keyboard.Listen(Key.W, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(1500, player.Angle)); 829 Keyboard.Listen(Key.S, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(-500, player.Angle)); 830 Keyboard.Listen(Key.D, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(-1000, player.Angle + Angle.FromDegrees(90))); 831 Keyboard.Listen(Key.A, ButtonState.Down, liike, "liiku", Vector.FromLengthAndAngle(1000, player.Angle + Angle.FromDegrees(90)));*/ 567 832 568 833 Keyboard.Listen(Key.W, ButtonState.Down, liike, "liiku", new Vector(0, 500)); 569 Keyboard.Listen(Key.S, ButtonState.Down, liike, "liiku", new Vector(0, - 250));834 Keyboard.Listen(Key.S, ButtonState.Down, liike, "liiku", new Vector(0, -500)); 570 835 Keyboard.Listen(Key.D, ButtonState.Down, liike, "liiku", new Vector(500, 0)); 571 836 Keyboard.Listen(Key.A, ButtonState.Down, liike, "liiku", new Vector(-500, 0)); 572 837 573 Mouse.IsCursorVisible = true;574 Mouse.ListenMovement(0.0, kaanny, "");838 Mouse.IsCursorVisible = false; 839 //Mouse.ListenMovement(0.0, kaanny, ""); 575 840 576 841 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 577 842 } 578 void kaanny(AnalogState hiirenLiike) 579 { 580 Vector suunta = Mouse.PositionOnWorld - player.AbsolutePosition; 843 void kaanny(Vector kaannos) 844 { 845 //Vector suunta = Mouse.PositionOnWorld - player.AbsolutePosition; 846 Vector suunta = kaannos; 581 847 582 848 if (suunta.Magnitude != 0) … … 588 854 void liike(Vector vektori) 589 855 { 590 player.Move((player.Angle + vektori.Angle + Angle.FromDegrees(-90)).GetVector() * vektori.Magnitude); 591 } 592 593 void LuoOvi(Vector paikka, double leveys, double korkeus, Angle Kulma) 594 { 595 ovi = PhysicsObject.CreateStaticObject(leveys, korkeus); 596 ovi.Position = paikka; 597 Image c = LoadImage("door"); 598 599 ovi.Image = c; 600 ovi.Tag = "ovi"; 601 602 603 604 Add(ovi); 605 606 } 856 //player.Move((player.Angle + vektori.Angle + Angle.FromDegrees(-90)).GetVector() * vektori.Magnitude); 857 //player.Move(vektori); 858 player.Push(vektori * 30); 859 player.Angle = player.Velocity.Angle; 860 } 861 862 607 863 void luoStaminup(Vector paikka, double leveys, double korkeus) 608 864 { … … 644 900 aseet(); 645 901 } 646 /* PhysicsObject Luokolo(Vector paikka, double leveys, double korkeus, Image kuva)647 {648 PhysicsObject kolo = PhysicsObject.CreateStaticObject(leveys, korkeus);649 kolo.Position = paikka;650 651 //taso.CollisionIgnoreGroup = 1;652 kolo.Color = Color.Gray;653 654 655 kolo.Image = kuva;656 Add(kolo);657 return kolo;658 }659 void Luokolo1(Vector paikka, double leveys, double korkeus)660 {661 Luokolo(paikka, leveys, korkeus, lattiakolo[0]);662 }663 void Luokolo2(Vector paikka, double leveys, double korkeus)664 {665 PhysicsObject kolo = Luokolo(paikka, leveys, korkeus, lattiakolo[3]);666 667 }668 void Luokolo3(Vector paikka, double leveys, double korkeus)669 {670 PhysicsObject kolo = Luokolo(paikka, leveys, korkeus, lattiakolo[4]);671 672 }673 void Luokolo4(Vector paikka, double leveys, double korkeus)674 {675 PhysicsObject kolo = Luokolo(paikka, leveys, korkeus, lattiakolo[5]);676 677 }678 void Luokolo5(Vector paikka, double leveys, double korkeus)679 {680 PhysicsObject kolo = Luokolo(paikka, leveys, korkeus, lattiakolo[2]);681 682 }*/683 902 684 903 -
2015/23/HenriK/dungeoncrawlar/dungeoncrawlar/dungeoncrawlar/dungeoncrawlar.csproj
r5865 r7234 111 111 </ItemGroup> 112 112 <ItemGroup> 113 <Compile Include="luolaGen.cs" /> 113 114 <Compile Include="Ohjelma.cs" /> 114 115 <Compile Include="dungeoncrawlar.cs" /> -
2015/23/HenriK/dungeoncrawlar/dungeoncrawlar/dungeoncrawlarContent/dungeoncrawlarContent.contentproj
r5894 r7234 88 88 </ItemGroup> 89 89 <ItemGroup> 90 <Compile Include=" huone1.txt">91 <Name> huone1</Name>90 <Compile Include="boss.txt"> 91 <Name>boss</Name> 92 92 <Importer>TextFileImporter</Importer> 93 93 <Processor>TextFileContentProcessor</Processor> … … 137 137 </ItemGroup> 138 138 <ItemGroup> 139 <Compile Include="zombi.png">140 <Name>zombi</Name>141 <Importer>TextureImporter</Importer>142 <Processor>TextureProcessor</Processor>143 </Compile>144 </ItemGroup>145 <ItemGroup>146 139 <Compile Include="Untitled.png"> 147 140 <Name>Untitled</Name> 148 <Importer>TextureImporter</Importer>149 <Processor>TextureProcessor</Processor>150 </Compile>151 </ItemGroup>152 <ItemGroup>153 <Compile Include="zombi1.png">154 <Name>zombi1</Name>155 <Importer>TextureImporter</Importer>156 <Processor>TextureProcessor</Processor>157 </Compile>158 <Compile Include="zombi2.png">159 <Name>zombi2</Name>160 <Importer>TextureImporter</Importer>161 <Processor>TextureProcessor</Processor>162 </Compile>163 <Compile Include="zombi3.png">164 <Name>zombi3</Name>165 <Importer>TextureImporter</Importer>166 <Processor>TextureProcessor</Processor>167 </Compile>168 <Compile Include="zombi4.png">169 <Name>zombi4</Name>170 <Importer>TextureImporter</Importer>171 <Processor>TextureProcessor</Processor>172 </Compile>173 <Compile Include="zombi5.png">174 <Name>zombi5</Name>175 <Importer>TextureImporter</Importer>176 <Processor>TextureProcessor</Processor>177 </Compile>178 <Compile Include="zombi6.png">179 <Name>zombi6</Name>180 <Importer>TextureImporter</Importer>181 <Processor>TextureProcessor</Processor>182 </Compile>183 <Compile Include="zombi7.png">184 <Name>zombi7</Name>185 141 <Importer>TextureImporter</Importer> 186 142 <Processor>TextureProcessor</Processor> … … 252 208 </ItemGroup> 253 209 <ItemGroup> 254 <Compile Include="blackwhitegorund bloody1.png">255 <Name>blackwhitegorund bloody1</Name>256 <Importer>TextureImporter</Importer>257 <Processor>TextureProcessor</Processor>258 </Compile>259 <Compile Include="blackwhitegorund bloody2.png">260 <Name>blackwhitegorund bloody2</Name>261 <Importer>TextureImporter</Importer>262 <Processor>TextureProcessor</Processor>263 </Compile>264 </ItemGroup>265 <ItemGroup>266 <Compile Include="blackwhiteground.png">267 <Name>blackwhiteground</Name>268 <Importer>TextureImporter</Importer>269 <Processor>TextureProcessor</Processor>270 </Compile>271 </ItemGroup>272 <ItemGroup>273 210 <Compile Include="huone3.txt"> 274 211 <Name>huone3</Name> … … 335 272 <Compile Include="blackwhitegroundhole4 - Copy.png"> 336 273 <Name>blackwhitegroundhole4 - Copy</Name> 274 <Importer>TextureImporter</Importer> 275 <Processor>TextureProcessor</Processor> 276 </Compile> 277 </ItemGroup> 278 <ItemGroup> 279 <Compile Include="weedragon hed.png"> 280 <Name>weedragon hed</Name> 281 <Importer>TextureImporter</Importer> 282 <Processor>TextureProcessor</Processor> 283 </Compile> 284 </ItemGroup> 285 <ItemGroup> 286 <Compile Include="weedragon.png"> 287 <Name>weedragon</Name> 288 <Importer>TextureImporter</Importer> 289 <Processor>TextureProcessor</Processor> 290 </Compile> 291 </ItemGroup> 292 <ItemGroup> 293 <Compile Include="dedragon.png"> 294 <Name>dedragon</Name> 295 <Importer>TextureImporter</Importer> 296 <Processor>TextureProcessor</Processor> 297 </Compile> 298 </ItemGroup> 299 <ItemGroup> 300 <Compile Include="dedragon bod.png"> 301 <Name>dedragon bod</Name> 302 <Importer>TextureImporter</Importer> 303 <Processor>TextureProcessor</Processor> 304 </Compile> 305 </ItemGroup> 306 <ItemGroup> 307 <Compile Include="lizerd1.png"> 308 <Name>lizerd1</Name> 309 <Importer>TextureImporter</Importer> 310 <Processor>TextureProcessor</Processor> 311 </Compile> 312 <Compile Include="lizerd2.png"> 313 <Name>lizerd2</Name> 314 <Importer>TextureImporter</Importer> 315 <Processor>TextureProcessor</Processor> 316 </Compile> 317 <Compile Include="lizerd3.png"> 318 <Name>lizerd3</Name> 319 <Importer>TextureImporter</Importer> 320 <Processor>TextureProcessor</Processor> 321 </Compile> 322 <Compile Include="lizerd4.png"> 323 <Name>lizerd4</Name> 324 <Importer>TextureImporter</Importer> 325 <Processor>TextureProcessor</Processor> 326 </Compile> 327 </ItemGroup> 328 <ItemGroup> 329 <Compile Include="lizerded.png"> 330 <Name>lizerded</Name> 331 <Importer>TextureImporter</Importer> 332 <Processor>TextureProcessor</Processor> 333 </Compile> 334 </ItemGroup> 335 <ItemGroup> 336 <Compile Include="stooones mang.png"> 337 <Name>stooones mang</Name> 338 <Importer>TextureImporter</Importer> 339 <Processor>TextureProcessor</Processor> 340 </Compile> 341 <Compile Include="stooones mang2.png"> 342 <Name>stooones mang2</Name> 343 <Importer>TextureImporter</Importer> 344 <Processor>TextureProcessor</Processor> 345 </Compile> 346 <Compile Include="stooones mang3.png"> 347 <Name>stooones mang3</Name> 348 <Importer>TextureImporter</Importer> 349 <Processor>TextureProcessor</Processor> 350 </Compile> 351 </ItemGroup> 352 <ItemGroup> 353 <Compile Include="NRGpellet1.png"> 354 <Name>NRGpellet1</Name> 355 <Importer>TextureImporter</Importer> 356 <Processor>TextureProcessor</Processor> 357 </Compile> 358 <Compile Include="NRGpellet2.png"> 359 <Name>NRGpellet2</Name> 360 <Importer>TextureImporter</Importer> 361 <Processor>TextureProcessor</Processor> 362 </Compile> 363 <Compile Include="NRGpellet3.png"> 364 <Name>NRGpellet3</Name> 365 <Importer>TextureImporter</Importer> 366 <Processor>TextureProcessor</Processor> 367 </Compile> 368 <Compile Include="NRGpellet4.png"> 369 <Name>NRGpellet4</Name> 370 <Importer>TextureImporter</Importer> 371 <Processor>TextureProcessor</Processor> 372 </Compile> 373 <Compile Include="NRGpellet5.5.png"> 374 <Name>NRGpellet5.5</Name> 375 <Importer>TextureImporter</Importer> 376 <Processor>TextureProcessor</Processor> 377 </Compile> 378 <Compile Include="NRGpellet5.png"> 379 <Name>NRGpellet5</Name> 380 <Importer>TextureImporter</Importer> 381 <Processor>TextureProcessor</Processor> 382 </Compile> 383 <Compile Include="NRGpellet6.png"> 384 <Name>NRGpellet6</Name> 385 <Importer>TextureImporter</Importer> 386 <Processor>TextureProcessor</Processor> 387 </Compile> 388 <Compile Include="NRGpellet7.png"> 389 <Name>NRGpellet7</Name> 390 <Importer>TextureImporter</Importer> 391 <Processor>TextureProcessor</Processor> 392 </Compile> 393 </ItemGroup> 394 <ItemGroup> 395 <Compile Include="liz king.png"> 396 <Name>liz king</Name> 337 397 <Importer>TextureImporter</Importer> 338 398 <Processor>TextureProcessor</Processor>
Note: See TracChangeset
for help on using the changeset viewer.