public Player() { this.rightHand = new Hand(Vector2.Zero); this.leftHand = new Hand(Vector2.Zero); this.rightFoot = new Hand(Vector2.Zero); this.leftFoot = new Hand(Vector2.Zero); }
/// <summary> /// Kick with the foot /// </summary> /// <param name="h"></param> public void kick(Hand h) { float speed = h.moveVector.Length(); if (speed < 15) return; //stomp on ground if (h.pos.Y > 610 && h.moveVector.Y > 20 && h.moveVector.Y > 0) { EffectUtil.createShockwave(Game1.particleSimulator.psNoGrav, h.pos); EffectUtil.createExplosion(Game1.particleSimulator.psGrav, h.pos, new Vector2(0, -4), new Vector2(6, 2), 2); killPeople(h.pos); return; } //kick people for (int i = 0; i < this.peopleList.Count; i++) { People p = this.peopleList[i]; if (Vector2.Distance(p.position, h.pos) < 50) { p.setHealth(0); Vector2 kickV = h.moveVector; if(kickV.Y > 0) kickV.Y *= -1; if (kickV.Y < -10) kickV.Y = -10; EffectUtil.createDeadPerson(Game1.particleSimulator.psGrav, p.position, kickV , p.getType(), p.getScale()); } } }
//******************* Player Effects Like Kicking and Punching *************************** /// <summary> /// Bash with the hand on the ground /// </summary> /// <param name="h"></param> public void bash(Hand h) { float hSpeed = h.getHorizontalSpeed(); float speed = h.moveVector.Length(); //hit ground if (h.pos.Y > 620 && speed > 5)//.Y > 10 && h.moveVector.Y > 0 { EffectUtil.createShockwave(Game1.particleSimulator.psNoGrav, h.pos); EffectUtil.createExplosion(Game1.particleSimulator.psGrav, h.pos, new Vector2(0, -4), new Vector2(6, 2), 2); killPeople(h.pos); return; } //hit house if (hSpeed > 20) { for (int i = 0; i < buildingList.Count; i++) { Floor f = buildingList[i].ishit(h.pos, 30, 200); if (f != null) { f.damage(10 + rand.Next(5)); EffectUtil.createExplosionWithSmoke(Game1.particleSimulator.psGrav, h.pos, h.moveVector.X); EffectUtil.createExplosion(Game1.particleSimulator.psGrav, h.pos, new Vector2(0, -4), new Vector2(6, 2), 2); } } } }
//******************* Player Effects Like Kicking and Punching *************************** /// <summary> /// Bash with the hand on the ground /// </summary> /// <param name="h"></param> public void bash(Hand h) { float hSpeed = h.getHorizontalSpeed(); //hit ground if (h.pos.Y > 620 && h.moveVector.Y > 10 && h.moveVector.Y > 0) { EffectUtil.createShockwave(Game1.particleSimulator.psNoGrav, h.pos); EffectUtil.createExplosion(Game1.particleSimulator.psGrav, h.pos, new Vector2(0, -4), new Vector2(6, 2), 2); killPeople(h.pos); return; } //hit house if (hSpeed > 30) { for (int i = 0; i < buildingList.Count; i++) { if (buildingList[i].ishit(h.pos, 30, 200)) { EffectUtil.createExplosionWithSmoke(Game1.particleSimulator.psGrav, h.pos, 2); EffectUtil.createExplosionWithSmoke(Game1.particleSimulator.psGrav, h.pos, -2); } } } }