public void giveBullets(HUD h1) { if (h1.bullet <= 80) { h1.bullet += 20; } }
public void draw(SpriteBatch spriteBatch,HUD h1) { if(h1.BoundingBox.Intersects(this.boundingbox)){ if (this.alive == true) { spriteBatch.Draw(texture, position, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.5f); } } }
public void Draw(SpriteBatch spriteBatch,HUD h1) { if(this.db.BoundingBox.Intersects(h1.BoundingBox)){ db.Draw(spriteBatch); } if (this.IAdb.BoundingBox.Intersects(h1.BoundingBox)) { IAdb.Draw(spriteBatch); } if (this.InvDb.BoundingBox.Intersects(h1.BoundingBox)) { InvDb.Draw(spriteBatch); } }
public void Draw(SpriteBatch spriteBatch,HUD h1) { if(this.BoundingBox.Intersects(h1.BoundingBox)){ if (Velocity.X > 0) { p1.DrawEvilChopper(spriteBatch, texture, this, SpriteEffects.None); } if (Velocity.X < 0) { p1.DrawEvilChopper(spriteBatch, texture, this, SpriteEffects.FlipHorizontally); } if (alive == false) { splosions.draw(spriteBatch,this); } } }
public void giveMissles(HUD h1) { h1.Missile += 5; }
public void Update(HUD hud, VIP vip,Crosshair crosshair, ContentManager Content, Viewport viewport,GameTime gameTime) { CollDetect(); VipCollDetect(vip,para1); j1.update(vip); para1.update(vip); j2.update(vip); for (int i = 0; i < WaveEnemies.Count; i++){ if (WaveEnemies.Count > 0) { WaveEnemies[i].Update(hud, vip,gameTime); WaveEnemies[i].text.update(WaveEnemies[i]); } } checkWave(crosshair,vip,Content,viewport); getAlive(crosshair, vip, Content, viewport,hud); }
public void getAlive(Crosshair crosshair, VIP vip, ContentManager Content, Viewport viewport,HUD h1) { for(int i=0; i< WaveEnemies.Count;i++) { if (WaveEnemies[i].alive==false) { if (WaveEnemies[i].splosions.transparency < -2f) { WaveEnemies.RemoveAt(i); crosshair.totalKilled += 1; choppersKilled += 1; h1.score += 200; } /* while (timer <= 2) { timer += 0.025f; } if (timer >= 2) { WaveEnemies.RemoveAt(i); h1.score += 200; timer = 0; }*/ } } if (WaveEnemies.Count == 0 ) { // genWave(5, crosshair, vip, Content, viewport); //full = false; waveNumber += 1; } }
//check if all the enemies are alive, if not, add new EM to list, remove previous. public void Draw(SpriteBatch spriteBatch, Viewport viewport,HUD h1) { para1.Draw(spriteBatch); j1.draw(spriteBatch,h1); j2.draw(spriteBatch,h1); for(int i=0; i<WaveEnemies.Count;i++) { if (WaveEnemies.Count > 0) { if (WaveEnemies[i].alive == true) { WaveEnemies[i].Draw(spriteBatch,h1); } if (WaveEnemies[i].alive == false) { WaveEnemies[i].text.draw(spriteBatch); WaveEnemies[i].splosions.draw(spriteBatch,WaveEnemies[i]); } } } }
public abstract void Update(HUD hud, VIP vip);
public void Update(HUD hud, VIP vip, GameTime gametime) { if (vip.Position.X < Position.X) { Velocity.X -= 0.05f; } if (Velocity.X > 3) { Velocity.X = 3; } if (Velocity.X < -3) { Velocity.X = -3; } if (Velocity.Y > 3) { Velocity.Y = 3; } if (Velocity.Y < -3) { Velocity.Y = -3; } if (vip.Position.X > Position.X) { Velocity.X += 0.05f; } if (vip.Position.Y < Position.Y) { Velocity.Y -= 0.05f; } if (vip.Position.Y > Position.Y) { Velocity.Y += 0.05f; } Position += Velocity; rotation = Velocity.X / 10; splosions.update(this); p1.AnimateEvilChopper(gametime); }
public void Draw(SpriteBatch spriteBatch, HUD h1) { #region RankDrawing if (RankOfYourGuy == Rank.Private) { spriteBatch.Draw(Private, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.Specialist) { spriteBatch.Draw(Specialist, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.Corporal) { spriteBatch.Draw(Corporal, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //1,2,3 if (RankOfYourGuy == Rank.Sergeant) { spriteBatch.Draw(Sergeant, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.StaffSergeant) { spriteBatch.Draw(StaffSergeant, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.SergeantFirstClass) { spriteBatch.Draw(SergeantFirstClass, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //4,5,6 if (RankOfYourGuy == Rank.MasterSergeant) { spriteBatch.Draw(MasterSergeant, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.FirstSergeant) { spriteBatch.Draw(FirstSergeant, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.SergeantMajor) { spriteBatch.Draw(SergeantMajor, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //6,7,8 if (RankOfYourGuy == Rank.CommandSergeantMajor) { spriteBatch.Draw(CommandSergeantMajor, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.SecondLieutenant) { spriteBatch.Draw(SecondLieutenant, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.FirstLieutenant) { spriteBatch.Draw(FirstLieutenant, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //9,10,11 if (RankOfYourGuy == Rank.Captain) { spriteBatch.Draw(Captain, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.Major) { spriteBatch.Draw(Major, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.LieutenantColonel) { spriteBatch.Draw(LieutenantColonel, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //12,13,14 if (RankOfYourGuy == Rank.Colonel) { spriteBatch.Draw(Colonel, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.ColonelFirstClass) { spriteBatch.Draw(ColonelFirstClass, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.BrigadierGeneral) { spriteBatch.Draw(BrigadierGeneral, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //15,16,17 if (RankOfYourGuy == Rank.BrigadierGeneralFirstClass) { spriteBatch.Draw(BrigadierGeneralFirstClass, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.LieutenantGeneral) { spriteBatch.Draw(LieutenantGeneral, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //18,19,20 if (RankOfYourGuy == Rank.General) { spriteBatch.Draw(General, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.MajorGeneral) { spriteBatch.Draw(MajorGeneral, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } if (RankOfYourGuy == Rank.MajorGeneralFirstClass) { spriteBatch.Draw(MajorGeneralFirstClass, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //21,22,23 if (RankOfYourGuy == Rank.ChopperCommander) { spriteBatch.Draw(ChopperCommander, new Vector2(h1.Position.X + 30, h1.Position.Y + 300), null, Color.White, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0f); } //24 #endregion }
public void Update(Crosshair crosshair, HUD h1, WaveManager wm, DropBoxManager dbm) { medalstrue1 = medalstrue; medals1 = medals; #region MissileUpgrades if (crosshair.amountMissileShot == 5) {if(i==0){ missileUpgrade.Play(); missileOverTrans -= .05f; crosshair.missile.state = MissileUpgradeState.Normal; i = 1; } } if (crosshair.amountMissileShot == 20) { if (i == 1) { missileUpgrade.Play(); missileOverTrans -= .05f; crosshair.missile.state = MissileUpgradeState.Upgraded; if (missileOverTrans < -2f) { transparency = 1f; i = 2; } } } #endregion #region CrossHairPowerUpgraded if (crosshair.amountShot == 10) { if (i == 2) { upgrade.Play(); overlayAlive = true; transparency -= .05f; crosshair.power = CrossHairPowerState.SixHitKill; if (transparency < -2f) { overlayAlive = false; transparency = 1f; i = 3; } } } if (crosshair.amountShot == 20) { if (i == 3) { upgrade.Play(); overlayAlive = true; transparency -= .05f; if (transparency < -2f) { overlayAlive = false; transparency = 1f; i = 4; } crosshair.power = CrossHairPowerState.FiveHitKill; } } if (crosshair.amountShot == 30) { if (i == 4) { upgrade.Play(); overlayAlive = true; transparency -= .05f; crosshair.power = CrossHairPowerState.FourHitKill; if (transparency < -2f) { overlayAlive = false; transparency = 1f; i = 5; } } } if (crosshair.amountShot == 40) { if (i == 5) { upgrade.Play(); overlayAlive = true; transparency -= .05f; crosshair.power = CrossHairPowerState.ThreeHitKill; if (transparency < -2f) { overlayAlive = false; transparency = 1f; i = 6; } } } if (crosshair.amountShot == 50) { if (i == 6) { upgrade.Play(); overlayAlive = true; transparency -= .05f; crosshair.power = CrossHairPowerState.TwoHitKill; if (transparency < -2f) { overlayAlive = false; transparency = 1f; i = 7; } } } if (crosshair.amountShot == 70) { if (i == 7) { upgrade.Play(); overlayAlive = true; transparency -= .02f; crosshair.power = CrossHairPowerState.OneHitKill; if (transparency < -2f) { overlayAlive = false; transparency = 1f; i = 8; } } } #endregion #region CrosshairSizeUpgraded if (wm.waveNumber == 2 && wm.WaveEnemies.Count == 0) { upgrade.Play(); overlayAlive = true; transparency -= .05f; if (transparency < -2f) { overlayAlive = false; transparency = 1f; } crosshair.size = CrossHairSizeState.OneAndAHalfBigger; } if (wm.waveNumber == 12 && wm.WaveEnemies.Count == 0) { upgrade.Play(); overlayAlive = true; transparency -= .05f; if (transparency < -2f) { overlayAlive = false; transparency = 1f; } crosshair.size = CrossHairSizeState.TwoTimes; } #endregion #region RankAssignment if (crosshair.totalKilled >= 2&&crosshair.totalKilled<7) { if (Once == 0) { lvlUp.Play(); RankOfYourGuy = Rank.Specialist; h1.score += 100000; Once=1; } } if (crosshair.totalKilled >= 7 && crosshair.totalKilled < 17) { if (Once == 1) { lvlUp.Play(); RankOfYourGuy = Rank.Corporal; h1.score += 175000; Once=2; } } if (crosshair.totalKilled >= 17 && crosshair.totalKilled < 30) { if (Once == 2){ lvlUp.Play(); RankOfYourGuy = Rank.Sergeant; h1.score += 75000; Once = 3; } } if (crosshair.totalKilled >= 30 && crosshair.totalKilled < 34) { if (Once == 3) { lvlUp.Play(); RankOfYourGuy = Rank.StaffSergeant; h1.score += 40000; Once = 4; } } if (crosshair.totalKilled >= 34 && crosshair.totalKilled < 45) { if (Once == 4) { lvlUp.Play(); RankOfYourGuy = Rank.SergeantFirstClass; h1.score += 40000; Once = 5; } } if (crosshair.totalKilled >= 45 && crosshair.totalKilled < 55) { if (Once == 5) { lvlUp.Play(); RankOfYourGuy = Rank.MasterSergeant; h1.score += 40000; Once = 6; } } if (crosshair.totalKilled >= 55 && crosshair.totalKilled < 67) { if (Once == 6) { lvlUp.Play(); RankOfYourGuy = Rank.FirstSergeant; h1.score += 40000; Once = 7; } } if (crosshair.totalKilled >= 67 && crosshair.totalKilled < 80) { if (Once == 7) { lvlUp.Play(); RankOfYourGuy = Rank.SergeantMajor; h1.score += 40000; Once=8; } } if (crosshair.totalKilled >= 80 && crosshair.totalKilled < 100) { if (Once == 8) { lvlUp.Play(); RankOfYourGuy = Rank.CommandSergeantMajor; h1.score += 25000; Once=9; } } if (crosshair.totalKilled >= 100 && crosshair.totalKilled < 122) { if (Once == 9) { lvlUp.Play(); RankOfYourGuy = Rank.SecondLieutenant; h1.score += 25000; Once=10; } } if (crosshair.totalKilled >= 122 && crosshair.totalKilled < 143) { if (Once == 10) { lvlUp.Play(); RankOfYourGuy = Rank.FirstLieutenant; h1.score += 25000; Once=11; } } if (crosshair.totalKilled >= 143 && crosshair.totalKilled < 162) { if (Once == 11) { lvlUp.Play(); RankOfYourGuy = Rank.Captain; h1.score += 25000; Once=12; } } if (crosshair.totalKilled >= 162 && crosshair.totalKilled < 186) { if (Once == 12) { lvlUp.Play(); RankOfYourGuy = Rank.Major; h1.score += 25000; Once=13; } } if (crosshair.totalKilled >= 186 && crosshair.totalKilled < 206) { if (Once == 13) { lvlUp.Play(); RankOfYourGuy = Rank.LieutenantColonel; h1.score += 25000; Once=14; } } if (crosshair.totalKilled >= 206 && crosshair.totalKilled < 230) { if (Once == 14) { lvlUp.Play(); RankOfYourGuy = Rank.Colonel; h1.score += 25000; Once=15; } } if (crosshair.totalKilled >= 230 && crosshair.totalKilled < 260) { if (Once == 15) { lvlUp.Play(); RankOfYourGuy = Rank.ColonelFirstClass; h1.score += 25000; Once=16; } } if (crosshair.totalKilled >= 260 && crosshair.totalKilled < 291) { if (Once == 16) { lvlUp.Play(); RankOfYourGuy = Rank.BrigadierGeneral; h1.score += 25000; Once=17; } } if (crosshair.totalKilled >= 291 &&crosshair.totalKilled < 320) { if (Once == 17) { lvlUp.Play(); RankOfYourGuy = Rank.BrigadierGeneralFirstClass; h1.score += 25000; Once=18; } } if (crosshair.totalKilled >= 320&&crosshair.totalKilled<329) { if (Once == 18) { lvlUp.Play(); RankOfYourGuy = Rank.LieutenantGeneral; h1.score += 25000; Once=19; } } if (crosshair.totalKilled >= 329 && crosshair.totalKilled < 354) { if (Once == 19) { lvlUp.Play(); RankOfYourGuy = Rank.General; h1.score += 25000; Once=20; } } if (crosshair.totalKilled >= 354 && crosshair.totalKilled < 378) { if (Once == 20) { lvlUp.Play(); RankOfYourGuy = Rank.MajorGeneral; h1.score += 25000; Once=21; } } if (crosshair.totalKilled >= 378 && crosshair.totalKilled < 400) { if (Once == 21) { lvlUp.Play(); RankOfYourGuy = Rank.MajorGeneralFirstClass; h1.score += 25000; Once=22; } } if (crosshair.totalKilled >= 400) { if (Once == 22) { lvlUp.Play(); RankOfYourGuy = Rank.ChopperCommander; h1.score = 990000; Once=23; } } #endregion #region Medals if (dbm.DropBoxesHit > 1) { medalstrue[0] = true; } if (dbm.DropBoxesHit > 3) { medalstrue[1] = true; } if (dbm.DropBoxesHit > 5) { medalstrue[2] = true; } if (crosshair.amountShot > 50) { medalstrue[4] = true; } if (crosshair.amountShot > 75) { medalstrue[5] = true; } if (crosshair.amountShot > 100) { medalstrue[6] = true; } if (wm.choppersKilled > 20) { medalstrue[7] = true; } if (wm.choppersKilled > 60) { medalstrue[8] = true; } if (wm.choppersKilled > 100) { medalstrue[9] = true; } if (crosshair.amountMissileShot > 20) { medalstrue[10] = true; } if (crosshair.amountMissileShot > 40) { medalstrue[11] = true; } if (crosshair.amountMissileShot > 60) { medalstrue[12] = true; } if (wm.paratroopersKilled > 1) { medalstrue[13] = true; } if (wm.paratroopersKilled > 2) { medalstrue[14] = true; } if (wm.paratroopersKilled > 3) { medalstrue[15] = true; } if (wm.jetsKilled > 1) { medalstrue[16] = true; } if (wm.jetsKilled > 3) { medalstrue[17] = true; } if (wm.jetsKilled > 5) { medalstrue[18] = true; } #endregion #region HudUpgrades if(h1.score >= 150000 && h1.score <500000) { h1.HudUpg = HudUpgradeState.modernAge; } else if (h1.score >= 500000 && h1.score <= 999999) { h1.HudUpg = HudUpgradeState.nanoAge; } else { h1.HudUpg = HudUpgradeState.stoneAge; } #endregion }
public void update(HUD h1) { if(h1.score<333333 && h1.score>=0){ if (i == -1) { //sound.Play(); i = 0; } b[0].draw = true; b[1].draw = true; b[2].draw = true; b[3].draw = true; loop(b[1],b[2],b[3]); b[0].update(); b[1].update(); b[2].update(); b[3].update(); } if(h1.score<666666 &&h1.score>=333333){ b[4].draw = true; b[5].draw = true; b[6].draw = true; b[7].draw = true; if (i == 0) { sound.Play(); b[4].position.X = checkWhosLast(b[1], b[2], b[3]).position.X + b[4].image.Width; b[5].position.X = b[4].position.X + b[5].image.Width; b[6].position.X = b[5].position.X + b[6].image.Width; b[7].position.X = b[6].position.X + b[7].image.Width; i++; } loop(b[5],b[6],b[7]); kill(b[1], b[2], b[3]); b[4].update(); b[0].update(); b[5].update(); b[6].update(); b[7].update(); } if(h1.score<999999&&h1.score>=666666){ b[8].draw = true; b[9].draw = true; b[10].draw = true; b[11].draw = true; if (i == 1) { sound.Play(); b[8].position.X = checkWhosLast(b[5], b[6], b[7]).position.X + b[8].image.Width; b[9].position.X = b[8].position.X + b[9].image.Width; b[10].position.X = b[9].position.X + b[10].image.Width; b[11].position.X = b[10].position.X + b[11].image.Width; i++; } kill(b[5],b[6],b[7]); kill(b[1], b[2], b[3]); loop(b[9],b[10],b[11]); b[4].update(); b[0].update(); b[08].update(); b[9].update(); b[10].update(); b[11].update(); } if(h1.score>=999999){ b[12].draw = true; if (i == 2) { b[12].position.X = checkWhosLast(b[9], b[10], b[11]).position.X + b[12].image.Width; i++; } kill(b[9],b[10],b[11]); kill(b[5], b[6], b[7]); kill(b[1], b[2], b[3]); if(b[12].position.X<0){ b[12].position.X = 0; } b[4].update(); b[0].update(); b[08].update(); b[12].update(); } }
public void Update(WaveManager wm,HUD h1,background b1, DropBoxManager dbm, VIP vip) { missile.update(this); Move( h1); sound.Play(); missile.checkEnemys(wm); #region PowerAssignment if (power == CrossHairPowerState.SevenHitKill) { strength = 1; } if (power == CrossHairPowerState.SixHitKill) { strength = 1.5f; } if (power == CrossHairPowerState.FiveHitKill) { strength = 2.0f; } if (power == CrossHairPowerState.FourHitKill) { strength = 2.5f; } if (power == CrossHairPowerState.ThreeHitKill) { strength = 3.0f; } if (power == CrossHairPowerState.TwoHitKill) { strength = 3.5f; } if (power == CrossHairPowerState.OneHitKill) { strength = 7.0f; } #endregion // accelerometer.ReadingChanged += new EventHandler<AccelerometerReadingEventArgs>(AccelerometerReadingChanged); if (TouchPanel.IsGestureAvailable) { GestureSample touch = TouchPanel.ReadGesture(); if (touch.Delta.Y < 0) { Velocity.Y =-7f; } if (touch.Delta.Y < 0&&touch.Delta.X<0) { Velocity.Y= -7f; Velocity.X = -7f; } if (touch.Delta.Y > 0 && touch.Delta.X > 0) { Velocity.Y =-7f; Velocity.X = 7f; } if (touch.Delta.Y > 0 && touch.Delta.X < 0) { Velocity.Y = 7f; Velocity.X =-7f; } if (touch.Delta.Y < 0 && touch.Delta.X > 0) { Velocity.Y = -7f; Velocity.X = 7f; } if (touch.Delta.Y > 0) { Velocity.Y = 7f; } if (touch.Delta.X < 0) { Velocity.X = -7f; } if (touch.Delta.X > 0) { Velocity.X = 7f; } if (touch.GestureType == GestureType.Tap) { if (h1.bullet > 0) { amountShot += 1; if (dbm.IAdb.active == false) { h1.bullet = h1.bullet - 1; } fired = true; h1.firedTimer = 0; bulletSound.Play(); //fire bullet; } } if (wm.waveNumber >= 3) { if (touch.GestureType == GestureType.Hold) { if (h1.Missile > 0) { amountMissileShot += 1; if (dbm.IAdb.active == false) { h1.Missile = h1.Missile - 1; } fired = true; explode.Play(); h1.firedTimer = 0; missile.alive = true; } //fire bullet; } } } /*if (accelReading.Z < -.7f) { Velocity.Y = -5f; } if (accelReading.Z > -.35f) { Velocity.Y = 5f; } if (accelReading.X < -.3f) { // Velocity.Y += 1f; } if (accelReading.X > .3f) { // Velocity.Y -= .2f; } if (accelReading.Y < -.2f) { Velocity.X = -5f; } if (accelReading.Y > .2f) { Velocity.X = 5f; }*/ #region Clamping if (this.Position.X < 400) { this.Position.X = (400); Velocity.X = 0; } if (this.Position.Y < b1.b[0].position.Y+(h1.pit.Height/2)) { this.Position.Y = b1.b[0].position.Y+(h1.pit.Height / 2); Velocity.Y = 0; } if (this.Position.X > 2200 - (h1.pit.Width)) { this.Position.X = 2200 - h1.pit.Width; Velocity.X = -1; } if (this.Position.Y > 2000 - (h1.pit.Height / 2)) { this.Position.Y = 2000 - (h1.pit.Height / 2); Velocity.Y = -1; } #endregion #region DropboxShootingBasedOnCrosshairSize if (size == CrossHairSizeState.Original) { if (dbm.db.alive == true && fired == true && dbm.db.BoundingBox.Intersects(this.BoundingBox)) { dbm.db.alive = false; if (dbm.db.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.db.Position = new Vector2(600, 0); dbm.db.Velocity = new Vector2(0, 0); dbm.timing = 0f; reload.Play(); dbm.db.giveBullets(h1); dbm.db.giveMissles(h1); dbm.ok = 0; vip.health += 33.3f; } } if (dbm.IAdb.alive == true && fired == true && dbm.IAdb.BoundingBox.Intersects(this.BoundingBox)) { dbm.IAdb.active = true; dbm.IAdb.countdown = -1.0f; dbm.IAdb.alive = false; if (dbm.IAdb.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.IAdb.Position = new Vector2(600, 0); dbm.IAdb.Velocity = new Vector2(0, 0); dbm.IAdbTiming = 0f; //dbm.IAdb.infinityTIME = InfinityState.Alive; reload.Play(); dbm.ok = 0; } } if (dbm.InvDb.alive == true && fired == true && dbm.InvDb.BoundingBox.Intersects(this.BoundingBox)) { dbm.InvDb.active = true; dbm.InvDb.countdown = -1.0f; dbm.InvDb.alive = false; if (dbm.InvDb.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.InvDb.Position = new Vector2(600, 0); dbm.InvDb.Velocity = new Vector2(0, 0); dbm.InvTiming = 0f; //dbm.IAdb.infinityTIME = InfinityState.Alive; reload.Play(); dbm.ok = 0; } } } if (size == CrossHairSizeState.OneAndAHalfBigger) { if (dbm.db.alive == true && fired == true && dbm.db.BoundingBox.Intersects(this.BoundingBox1point5)) { dbm.db.alive = false; if (dbm.db.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.db.Position = new Vector2(600, 0); dbm.db.Velocity = new Vector2(0, 0); dbm.timing = 0f; reload.Play(); dbm.db.giveBullets(h1); dbm.db.giveMissles(h1); dbm.ok = 0; vip.health += 33.3f; } } if (dbm.IAdb.alive == true && fired == true && dbm.IAdb.BoundingBox.Intersects(this.BoundingBox1point5)) { dbm.IAdb.active = true; dbm.IAdb.alive = false; if (dbm.IAdb.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.IAdb.Position = new Vector2(600, 0); dbm.IAdb.Velocity = new Vector2(0, 0); dbm.IAdbTiming = 0f; reload.Play(); //dbm.IAdb.infinityTIME = InfinityState.Alive; dbm.ok = 0; } } if (dbm.InvDb.alive == true && fired == true && dbm.InvDb.BoundingBox.Intersects(this.BoundingBox)) { dbm.InvDb.active = true; dbm.InvDb.countdown = -1.0f; dbm.InvDb.alive = false; if (dbm.InvDb.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.InvDb.Position = new Vector2(600, 0); dbm.InvDb.Velocity = new Vector2(0, 0); dbm.InvTiming = 0f; //dbm.IAdb.infinityTIME = InfinityState.Alive; reload.Play(); dbm.ok = 0; } } } if (size == CrossHairSizeState.TwoTimes) { if (dbm.db.alive == true && fired == true && dbm.db.BoundingBox.Intersects(this.BoundingBox2)) { dbm.db.alive = false; if (dbm.db.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.db.Position = new Vector2(600, 0); dbm.db.Velocity = new Vector2(0, 0); dbm.timing = 0f; reload.Play(); dbm.db.giveBullets(h1); dbm.db.giveMissles(h1); dbm.ok = 0; vip.health += 33.3f; } } if (dbm.IAdb.alive == true && fired == true && dbm.IAdb.BoundingBox.Intersects(this.BoundingBox2)) { dbm.IAdb.active = true; dbm.IAdb.alive = false; if (dbm.IAdb.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.IAdb.Position = new Vector2(600, 0); dbm.IAdb.Velocity = new Vector2(0, 0); dbm.IAdbTiming = 0f; reload.Play(); //dbm.IAdb.infinityTIME = InfinityState.Alive; dbm.ok = 0; } } if (dbm.InvDb.alive == true && fired == true && dbm.InvDb.BoundingBox.Intersects(this.BoundingBox)) { dbm.InvDb.active = true; dbm.InvDb.countdown = -1.0f; dbm.InvDb.alive = false; if (dbm.InvDb.boom.transparency < -2f) { dbm.DropBoxesHit += 1; dbm.InvDb.Position = new Vector2(600, 0); dbm.InvDb.Velocity = new Vector2(0, 0); dbm.InvTiming = 0f; //dbm.IAdb.infinityTIME = InfinityState.Alive; reload.Play(); dbm.ok = 0; } } } #endregion #region ParatrooperDyingBasedOnCrossSize if (size == CrossHairSizeState.Original) { if (wm.para1.otherBox == false) { if (wm.para1.alive == true && fired == true && wm.para1.BoundingBox.Intersects(this.BoundingBox)) { //wm.para1.BoundingBox wm.paratroopersKilled += 1; totalKilled += 1; wm.para1.alive = false; wm.para1.Position = new Vector2(600, 0); wm.para1.Velocity = new Vector2(0, 0); wm.para1.timing = 0f; } } if (wm.para1.otherBox == true) { if (wm.para1.alive == true && fired == true && wm.para1.BoundingBoxNoPara.Intersects(this.BoundingBox)) { //wm.para1.BoundingBox wm.paratroopersKilled += 1; totalKilled += 1; wm.para1.alive = false; wm.para1.Position = new Vector2(600, 0); wm.para1.Velocity = new Vector2(0, 0); wm.para1.timing = 0f; wm.para1.otherBox = false; } } } if (size == CrossHairSizeState.OneAndAHalfBigger) { if (wm.para1.otherBox == false) { if (wm.para1.alive == true && fired == true && wm.para1.BoundingBox.Intersects(this.BoundingBox1point5)) { //wm.para1.BoundingBox wm.paratroopersKilled += 1; totalKilled += 1; wm.para1.alive = false; wm.para1.Position = new Vector2(600, 0); wm.para1.Velocity = new Vector2(0, 0); wm.para1.timing = 0f; } } if (wm.para1.otherBox == true) { if (wm.para1.alive == true && fired == true && wm.para1.BoundingBoxNoPara.Intersects(this.BoundingBox1point5)) { //wm.para1.BoundingBox wm.paratroopersKilled += 1; totalKilled += 1; wm.para1.alive = false; wm.para1.Position = new Vector2(600, 0); wm.para1.Velocity = new Vector2(0, 0); wm.para1.timing = 0f; wm.para1.otherBox = false; } } } if (size == CrossHairSizeState.TwoTimes) { if (wm.para1.otherBox == false) { if (wm.para1.alive == true && fired == true && wm.para1.BoundingBox.Intersects(this.BoundingBox2)) { //wm.para1.BoundingBox wm.paratroopersKilled += 1; totalKilled += 1; wm.para1.alive = false; wm.para1.Position = new Vector2(600, 0); wm.para1.Velocity = new Vector2(0, 0); wm.para1.timing = 0f; } } if (wm.para1.otherBox == true) { if (wm.para1.alive == true && fired == true && wm.para1.BoundingBoxNoPara.Intersects(this.BoundingBox2)) { //wm.para1.BoundingBox wm.paratroopersKilled += 1; totalKilled += 1; wm.para1.alive = false; wm.para1.Position = new Vector2(600, 0); wm.para1.Velocity = new Vector2(0, 0); wm.para1.timing = 0f; wm.para1.otherBox = false; } } } #endregion //******************************************************************* //******************************************************************* // there may need to be a reset value for the movement when the phone is still /* else { Velocity= new Vector2(0,0); }*/ #region ChopperShotsWithUpGradesTakenIntoAccount for (int i=0;i<wm.WaveEnemies.Count;i++){ if (size == CrossHairSizeState.Original) { if (fired == true & wm.WaveEnemies[i].BoundingBox.Intersects(this.BoundingBox)) { wm.WaveEnemies[i].health -= strength; wm.WaveEnemies[i].Velocity.X = -wm.WaveEnemies[i].Velocity.X; wm.WaveEnemies[i].Velocity.Y = -wm.WaveEnemies[i].Velocity.Y; if (wm.WaveEnemies[i].health <= 0) { wm.WaveEnemies[i].alive = false; } } } //********************************************** if (size == CrossHairSizeState.OneAndAHalfBigger) { if (fired == true & wm.WaveEnemies[i].BoundingBox.Intersects(this.BoundingBox1point5)) { wm.WaveEnemies[i].health -= strength; wm.WaveEnemies[i].Velocity.X = -wm.WaveEnemies[i].Velocity.X; wm.WaveEnemies[i].Velocity.Y = -wm.WaveEnemies[i].Velocity.Y; if (wm.WaveEnemies[i].health <= 0) { wm.WaveEnemies[i].alive = false; } } } //********************************************** if (size == CrossHairSizeState.TwoTimes) { if (fired == true & wm.WaveEnemies[i].BoundingBox.Intersects(this.BoundingBox2)) { wm.WaveEnemies[i].health -= strength; wm.WaveEnemies[i].Velocity.X = -wm.WaveEnemies[i].Velocity.X; wm.WaveEnemies[i].Velocity.Y = -wm.WaveEnemies[i].Velocity.Y; if (wm.WaveEnemies[i].health <= 0) { wm.WaveEnemies[i].alive = false; } } } } #endregion #region JetsKilling if (size == CrossHairSizeState.Original) { if (fired = true && wm.j1.alive == true && wm.j1.boundingbox.Intersects(this.BoundingBox)) { totalKilled += 1; wm.jetsKilled += 1; wm.j1.alive = false; } if (fired = true && wm.j2.alive == true && wm.j2.boundingbox.Intersects(this.BoundingBox)) { totalKilled += 1; wm.jetsKilled += 1; wm.j2.alive = false; } } if (size == CrossHairSizeState.OneAndAHalfBigger) { if (fired = true && wm.j1.alive == true && wm.j1.boundingbox.Intersects(this.BoundingBox1point5)) { totalKilled += 1; wm.jetsKilled += 1; wm.j1.alive = false; } if (fired = true && wm.j2.alive == true && wm.j2.boundingbox.Intersects(this.BoundingBox1point5)) { totalKilled += 1; wm.jetsKilled += 1; wm.j2.alive = false; } } if (size == CrossHairSizeState.TwoTimes) { if (fired = true && wm.j1.alive == true && wm.j1.boundingbox.Intersects(this.BoundingBox2)) { totalKilled += 1; wm.jetsKilled += 1; wm.j1.alive = false; } if (fired = true && wm.j2.alive == true && wm.j2.boundingbox.Intersects(this.BoundingBox2)) { totalKilled += 1; wm.jetsKilled += 1; wm.j2.alive = false; } } #endregion }
/* public void AccelerometerReadingChanged(object sender, AccelerometerReadingEventArgs e) { accelReading.X = (float)e.X; accelReading.Y = (float)e.Y; accelReading.Z = (float)e.Z; }*/ public void Move(HUD h1) { Position += Velocity; Velocity.Y = 0; Velocity.X = 0; }
public void DrawHUD(SpriteBatch spriteBatch, Texture2D texture, HUD h1) { spriteBatch.Draw(texture, h1.Position, sourceBounds, Color.White, 0f, Origin, 1.0f, SpriteEffects.None, 0f); }