/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here MenuPause.Insert(graphics); spikesTrap.InsertSpikes(graphics); ecir = new Ecir(new Texture2D(graphics.GraphicsDevice, 50, 50), new Rectangle(-200, 400, 30, 50), new Vector2(1, 1), new Vector2(1, 1)); zombie = new Zombie(new Texture2D(graphics.GraphicsDevice, 50, 50), new Rectangle(400, 490, 30, 50), 1, 1, SpriteEffects.None); terrain1.InsertTerrain(graphics); skeleton.Insert(graphics); hollowKnight.InsertHollowKnight(graphics); stairs.InsertStairs(graphics); ogre.Insert(graphics); camera = new Camera(ecir.Rectangle.X, ecir.Rectangle.Y); //terrain1 = new Terrain1(new Texture2D(graphics.GraphicsDevice, 400, 400), new Rectangle(0, height - 100, 200, 100)); base.Initialize(); }
public void SkeletonLife() { // if (Ecir.cameraMove.X >= -50 && Ecir.cameraMove.X <= 100) index = 0;//ao definir esta área defino qual o indice do skeleton que estou a atacar ou qual posso ser atacado if (Ecir.cameraMove.X >= 1630 && Ecir.cameraMove.X <= 2200) { index = 0; } if (listzombieSkeleton[index] != null) { colzombieSkeleton = new Rectangle(listzombieSkeleton[index].Rectangle.X - 60, listzombieSkeleton[index].Rectangle.Y - 25, 150, 75); if (listzombieSkeleton[index].Direction == -1) { colzombieSkeleton = new Rectangle(listzombieSkeleton[index].Rectangle.X - 20, listzombieSkeleton[index].Rectangle.Y, 30, 75); } if (listzombieSkeleton[index].Direction == 1) { SkeletonAttackArea = new Rectangle(listzombieSkeleton[index].Rectangle.X + 20, listzombieSkeleton[index].Rectangle.Y, 30, 75); } if (colzombieSkeleton.Intersects(Ecir.cameraMove) && listzombieSkeleton[index].Rectangle.X >= Ecir.cameraMove.X && Ecir.directionPositive == true && Ecir.EcirAttack() == 1 || colzombieSkeleton.Intersects(Ecir.cameraMove) && listzombieSkeleton[index].Rectangle.X <= Ecir.cameraMove.X && Ecir.directionNegative == true && Ecir.EcirAttack() == 1) { if (listzombieSkeleton[index].Life > 90) { listzombieSkeleton[index].Life = 50; time = 0; } if (time >= 1 && listzombieSkeleton[index].Life == 50) { listzombieSkeleton[index].Life = 0; listzombieSkeleton[index] = null; } } } }
public void OgreLife() { if (Ecir.cameraMove.X >= 1899 && Ecir.cameraMove.X <= 2270) { index = 0; } if (Ecir.cameraMove.X >= 3400 && Ecir.cameraMove.X <= 3765) { index = 1; } if (listOgre[index] != null) { ogreCol = new Rectangle(listOgre[index].Rectangle.X - 60, listOgre[index].Rectangle.Y - 25, 150, 75); if (listOgre[index].Direction == -1) { ogreAttackArea = new Rectangle(listOgre[index].Rectangle.X - 20, listOgre[index].Rectangle.Y, 30, 75); } if (listOgre[index].Direction == 1) { ogreAttackArea = new Rectangle(listOgre[index].Rectangle.X + 20, listOgre[index].Rectangle.Y, 30, 75); } if (ogreCol.Intersects(Ecir.cameraMove) && listOgre[index].Rectangle.X >= Ecir.cameraMove.X && Ecir.directionPositive == true && Ecir.EcirAttack() == 1 || ogreCol.Intersects(Ecir.cameraMove) && listOgre[index].Rectangle.X <= Ecir.cameraMove.X && Ecir.directionNegative == true && Ecir.EcirAttack() == 1) { if (listOgre[index].Life > 250) { listOgre[index].Life = 250; time = 0; } if (time >= 0.7 && listOgre[index].Life == 250) { listOgre[index].Life = 150; time = 0; } if (time >= 0.7 && listOgre[index].Life == 150) { listOgre[index].Life = 100; time = 0; } if (time >= 0.7 && listOgre[index].Life == 100) { listOgre[index].Life = 50; time = 0; } if (time >= 0.7 && listOgre[index].Life == 50) { listOgre[index].Life = 0; listOgre[index] = null; } } } }
public int ZombieLife() { zombieColision = new Rectangle(zombieRectangle.X - 60, zombieRectangle.Y - 25, 120, 60); //////Ecir ataca pela direita if (zombieColision.Intersects(Ecir.cameraMove) && zombieRectangle.X >= Ecir.cameraMove.X && Ecir.directionPositive == true && Ecir.EcirAttack() == 1) { if (zombieLife != 50 && zombieLife != 0) { time = 0; zombieLife = 50; return(zombieLife); } if (time >= 1) { zombieLife = 0; return(zombieLife); } return(zombieLife); } //////Ecir ataca pela esquerda if (zombieColision.Intersects(Ecir.cameraMove) && zombieRectangle.X <= Ecir.cameraMove.X && Ecir.directionNegative == true && Ecir.EcirAttack() == 1) { if (zombieLife != 50 && zombieLife != 0) { time = 0; zombieLife = 50; ZombieColor(); return(zombieLife); } if (time >= 0.7) { zombieLife = 0; return(zombieLife); } return(zombieLife); } // Console.WriteLine("Zombie life=" + zombieLife); return(zombieLife); }
public void HollowKnightLife() { if (Ecir.cameraMove.X >= 820 && Ecir.cameraMove.X <= 1228) { index = 0; //define os indices do hollow knight num determinado intervalo de distancia } if (Ecir.cameraMove.X >= 1498 && Ecir.cameraMove.X <= 1826) { index = 1; } if (Ecir.cameraMove.X >= 2396 && Ecir.cameraMove.X <= 2565) { index = 2; } if (Ecir.cameraMove.X >= 3380 && Ecir.cameraMove.X <= 3755) { index = 3; } if (listHollowKnight[index] != null) { hollowKnightCol = new Rectangle(listHollowKnight[index].Rectangle.X - 60, listHollowKnight[index].Rectangle.Y - 25, 150, 75);//area de colisão de ataque do ecir if (listHollowKnight[index].Direction == -1) { hollowAttackArea = new Rectangle(listHollowKnight[index].Rectangle.X - 10, listHollowKnight[index].Rectangle.Y, 40, 75); //knight ataca pela esquerda } if (listHollowKnight[index].Direction == 1) { hollowAttackArea = new Rectangle(listHollowKnight[index].Rectangle.X + 40, listHollowKnight[index].Rectangle.Y, 40, 75); //knight ataca pela direita } //Ecir ataca pela direita e esquerda if (hollowKnightCol.Intersects(Ecir.cameraMove) && listHollowKnight[index].Rectangle.X >= Ecir.cameraMove.X && Ecir.directionPositive == true && Ecir.EcirAttack() == 1 || hollowKnightCol.Intersects(Ecir.cameraMove) && listHollowKnight[index].Rectangle.X <= Ecir.cameraMove.X && Ecir.directionNegative == true && Ecir.EcirAttack() == 1) { if (listHollowKnight[index].Life > 150) { listHollowKnight[index].Life = 150; time = 0; } if (time >= 0.7 && listHollowKnight[index].Life == 150) { listHollowKnight[index].Life = 100; time = 0; } if (time >= 0.7 && listHollowKnight[index].Life == 100) { listHollowKnight[index].Life = 50; time = 0; } if (time >= 0.7 && listHollowKnight[index].Life == 50) { listHollowKnight[index].Life = 0; listHollowKnight[index] = null; } } } }