public void checkWave(Crosshair crosshair, VIP vip, ContentManager Content, Viewport viewport) { if (waveNumber == 2 && WaveEnemies.Count== 0) { distance = 50; genWave(2, crosshair, vip, Content, viewport, 73); // full = true; } if (waveNumber == 3 && WaveEnemies.Count==0) { distance = 100; genWave(5, crosshair, vip, Content, viewport, 73); //full = true; } if (waveNumber >= 4 && WaveEnemies.Count == 0) { distance = 100; genWave(10, crosshair, vip, Content, viewport, 73); //full = true; } }
public void Draw(SpriteBatch spriteBatch, VIP vip,WaveManager wm,Crosshair cross) { if (HudUpg == HudUpgradeState.stoneAge) { spriteBatch.Draw(pit, Position, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.1f); } else if (HudUpg == HudUpgradeState.modernAge) { spriteBatch.Draw(pit3, Position, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.1f); } else if (HudUpg == HudUpgradeState.nanoAge) { spriteBatch.Draw(pit2, Position, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.1f); } spriteBatch.DrawString(health, "Wave:" + wm.waveNumber , new Vector2(this.Position.X+30, this.Position.Y+ 60), Color.Green,0f,Vector2.Zero,2f,SpriteEffects.None,0f); if(wm.waveNumber>=3){ spriteBatch.DrawString(health, "Missile : " + Missile , new Vector2(this.Position.X + 400, this.Position.Y + 450), Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } spriteBatch.DrawString(health, "Bullets : " + bullet , new Vector2(this.Position.X + 210, this.Position.Y + 450), Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); spriteBatch.DrawString(health, "HEALTH :" + vip.health, new Vector2(this.Position.X + 40, this.Position.Y + 20), Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); spriteBatch.DrawString(health, "Score :" + score, new Vector2(this.Position.X + 30, this.Position.Y + 120), Color.Green, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); if(this.BoundingBox.Intersects(vip.BoundingBox)){ } else if (vip.Position.Y < cross.Position.Y) { spriteBatch.Draw(arrowUP, new Vector2(this.Position.X + 70, this.Position.Y + 200), null, Color.White, 0f, Vector2.Zero, .33f, SpriteEffects.None, 0f); } else if(vip.Position.Y>cross.Position.Y) { spriteBatch.Draw(arrowDown, new Vector2(this.Position.X + 70, this.Position.Y + 200), null, Color.White, 0f, Vector2.Zero, .33f, SpriteEffects.None, 0f); } if (vip.health <= 0.0f) { spriteBatch.DrawString(gameover, "GAME OVER ", new Vector2(this.Position.X + 220, this.Position.Y + 440), Color.Gold); } }
public void Update( Crosshair crosshair) { Position = crosshair.Position -new Vector2(pit.Width/2,pit.Height/2); /* if (Position.X < 0+(pit.Width/2)) { Position.X = 0 + (pit.Width / 2); } if (Position.Y < 0 + (pit.Height/ 2)) { Position.Y = 0 + (pit.Height / 2); } if (Position.X >3000-(pit.Width )); { Position.X =3000-(pit.Width );; } if (Position.Y > 3000 - (pit.Height )) { Position.Y = 3000 - (pit.Height ); }*/ /*if (Position.X < -5) { Position.X = -5; } if (Position.X > (2000-pit.Width)) { Position.X = 2000 - pit.Width; } if (Position.Y < -5) { Position.Y = -5; } if (Position.Y >2000-pit.Height) { Position.Y = 2000- pit.Height; }*/ this.score = score; this.bullet = bullet; if (firedTimer >1) { crosshair.fired = false; } firedTimer++; }
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 LoadContent(ContentManager Content, Crosshair crosshair, VIP vip, Viewport viewport) { previousSpawnTime = TimeSpan.Zero; enemySpawnTime= TimeSpan.FromSeconds(10); genWave(2, crosshair, vip, Content, viewport, 50); j1=new Jet(Content,new Vector2(2000,400)); j2 = new Jet(Content, new Vector2(2000, 600)); para1 = new Paratrooper(new Vector2(1000, -400), Content); }
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; } }
public void genWave(int amount, Crosshair crosshair, VIP vip, ContentManager Content, Viewport viewport, int incDistance) { for (int i = 0; i < amount; i++) { if (waveNumber == 1) { genericDude = new EvilChopper(new Vector2((float)(vip.Position.X + 400 + ((double)distance * Math.PI)), RandomNumber(200, 700)), Content); genericDude.LoadContent(Content, viewport); WaveEnemies.Add(genericDude); } if (waveNumber >= 2) { for (float time = 0; time <= 8; time += .15f) { if (time >= 7) { genericDude = new EvilChopper(new Vector2((float)(vip.Position.X + 400 + ((double)distance * Math.PI)), RandomNumber(200, 700)), Content); genericDude.LoadContent(Content, viewport); WaveEnemies.Add(genericDude); } } } distance+=incDistance; } // heli.position.y=Random(0,200);//randomise its y value }
public void update(Crosshair crosshair) { if (state == MissileUpgradeState.HalfSize) { position = crosshair.Position - new Vector2(texture.Width / 4, texture.Height / 4); } if (state == MissileUpgradeState.Normal) { position = crosshair.Position - new Vector2(texture.Width /2, texture.Height/2); } if (state == MissileUpgradeState.Upgraded) { position = crosshair.Position - new Vector2(texture.Width , texture.Height); } if (this.alive == true) { transparency-=.3f; if(transparency<=-2f){ this.alive = false; transparency = 1f; } } }
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 }