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(VIP vip) { position += velocity; if(vip.BoundingBox.Intersects(boundingbox)){ position.X = 2000; position.Y = Random(50, 1800); vip.health -= 10; } if(boundingbox.Intersects(Near)){ jet.Volume = .7f; jet.Play(); } if (position.X < -200) { position.X = 2000; position.Y = Random(50, 1800); } if (this.alive == false) { for (float i = 0; i < 20; i += .25f) { if (i == 19) { this.alive = true; position.X = 2000; position.Y = Random(50, 1800); } } } }
public void VipCollDetect(VIP vip,Paratrooper p1) { for(int i=0;i<WaveEnemies.Count;i++){ if (vip.BoundingBox.Intersects(p1.BoundingBox)) { p1.Position = vip.Position; p1.texture = p1.textureNoPara; vip.health -= 0.0000000001f; p1.otherBox = true; // p1.BoundingBox = new Rectangle(p1.BoundingBoxNoPara.X,p1.BoundingBoxNoPara.Y,p1.BoundingBoxNoPara.Width,p1.BoundingBoxNoPara.Height); } else { p1.texture = p1.texturepara; } if(WaveEnemies[i].BoundingBox.Intersects(vip.BoundingBox)){ vip.health -= .02f; if (vip.Position.X > WaveEnemies[i].Position.X) { //vip.Velocity.X += .1f; WaveEnemies[i].Velocity.X -= .1f; } if (vip.Position.X <WaveEnemies[i].Position.X) { //vip.Velocity.X -= .1f; WaveEnemies[i].Velocity.X += .1f; } if (vip.Position.Y > WaveEnemies[i].Position.Y) { //vip.Velocity.Y += .1f; WaveEnemies[i].Velocity.Y -= .1f; } if (vip.Position.Y < WaveEnemies[i].Position.Y) { // vip.Velocity.Y -= .1f; WaveEnemies[i].Velocity.Y += .1f; } } } }
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 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 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 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 abstract void Update(HUD hud, VIP vip);
public void update(VIP vip) { timing += .025f; if (timing > 15.0f & ok == 0) { alive = true; otherBox = false; Velocity = new Vector2(0, 2); ok = 1; } /* else { otherBox = true; } why david? * */ if (timing > 30.0f) { timing = 0.0f; ok = 0; } if (vip.Position.X < Position.X) { Velocity.X = -2; } if (vip.Position.X > Position.X) { Velocity.X = 2; } if (Position.Y > 2000) { Position.Y = -500; } Position += Velocity; if (rotationAngle > .1f) { what = true; } if (rotationAngle < -.1) { what = false; } if (what == false) { rotationAngle += 0.01f; } if (what == true) { rotationAngle -= 0.01f; } }
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 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 DrawVIP(SpriteBatch spriteBatch, Texture2D texture, VIP c) { spriteBatch.Draw(texture, c.Position, sourceBounds,Color.White,c.rotationAngle, Origin,1.0f, SpriteEffects.None ,0.2f); }