public void CheckHitHero(Hero hero) { for (int i = 0; i < slimeList.Count; i++) { slimeList[i].CheckHitHero(hero); } }
public void CheckHitHero(Hero hero) { if (colRectangle.IntersectsWith(hero.colRectangle)) { slimes.Remove(this); if (hero.immune == false) { hero.health--; sndPain.Play(); } Console.WriteLine(hero.health); if (hero.health == 0) hero.dead = true; hero.immune = true; } }
public Manager() { mVideo = Video.SetVideoMode(794, 494); Console.Title = "Alien Terrorist Killer"; hero = new Hero(mVideo, SdlDotNet.Input.Key.A, SdlDotNet.Input.Key.D, SdlDotNet.Input.Key.Space, SdlDotNet.Input.MouseButton.PrimaryButton); // QWERTY dus A = Q enemy_1 = new Point(10, 305); enemy_2 = new Point(570, 305); enemy_3 = new Point(340, 185); enemy_4 = new Point(650, 65); heartContainerPoint = new Point(725, 185); heartPoint = new Point(20, 20); heartPoint2 = new Point(70, 20); heartPoint3 = new Point(120, 20); vijand1 = new Vijand(mVideo, enemy_1, 100, 290); vijand2 = new Vijand(mVideo, enemy_2, 570, 680); vijand3 = new Vijand(mVideo, enemy_3, 340, 570); vijand4 = new Vijand(mVideo, enemy_4, 650, 700); groundColRectangle = new Rectangle(0, 480, 794, 24); //486 = 510(17*30) - 24(Ground height) --- 794 (Ground width) 24 (Ground height) platform1_ColRectangle = new Rectangle(0, 360, 350, 15); platform2_ColRectangle = new Rectangle(570, 360, 350, 15); platform3_ColRectangle = new Rectangle(300, 240, 350, 15); // x = 10, y = 8 --> 10 *30 = 300 /// 8 * 30 = 240 /// x en y vanaf 0 tellen in array! platform4_ColRectangle = new Rectangle(660, 120, 350, 15); spikes1_ColRectangle = new Rectangle(420, 420, 85, 71); lasers = new Lasers(); slimes = new Slimes(); level1 = new Level1(mVideo); level2 = new Level2(mVideo); startscreen = new Startscreen(mVideo); endscreen = new Endscreen(mVideo); activelevel = startscreen; immuneTimer = 0; drawTimer = 0; shootTimer = 0; audioThread.Start(); sndLaser.Volume = sndPain.Volume = 15; Events.Tick += Events_Tick; Events.Run(); }
public void RestartLvl2() { hero = new Hero(mVideo, SdlDotNet.Input.Key.A, SdlDotNet.Input.Key.D, SdlDotNet.Input.Key.Space, SdlDotNet.Input.MouseButton.PrimaryButton); activelevel = level2; hero.position = hero.lvl2Position; heartContainer = new HeartContainer(mVideo, heartContainerPoint); spikes1_ColRectangle = new Rectangle(180, 420, 85, 71); platform1_ColRectangle = new Rectangle(0, 180, 350, 15); platform2_ColRectangle = new Rectangle(720, 240, 350, 15); platform3_ColRectangle = new Rectangle(330, 330, 350, 15); platform4_ColRectangle = new Rectangle(450, 330, 350, 15); enemy_1 = new Point(180, 125); enemy_2 = new Point(450, 275); enemy_3 = new Point(300, 425); enemy_4 = new Point(650, 425); vijand1 = new Vijand(mVideo, enemy_1, 180, 230); vijand2 = new Vijand(mVideo, enemy_2, 450, 600); vijand3 = new Vijand(mVideo, enemy_3, 300, 400); vijand4 = new Vijand(mVideo, enemy_4, 650, 700); }
public void RestartLvl1() { hero = new Hero(mVideo, SdlDotNet.Input.Key.A, SdlDotNet.Input.Key.D, SdlDotNet.Input.Key.Space, SdlDotNet.Input.MouseButton.PrimaryButton); vijand1 = new Vijand(mVideo, enemy_1, 100, 290); vijand2 = new Vijand(mVideo, enemy_2, 570, 680); vijand3 = new Vijand(mVideo, enemy_3, 340, 570); vijand4 = new Vijand(mVideo, enemy_4, 650, 700); }