protected void EndLevel() { SuperTank2.CurrentLevel += 1; Particule.ClearParticles(); PushScreen(new Shop()); RemoveScreen(this); }
public override void Draw(CustomSpriteBatch g) { g.End(); Background2D.Draw(g, Constants.Width, Constants.Height); g.Begin(); for (int B = 0; B < ListBackgroundObject.Count; B++) { if (ListBackgroundObject[B].IsAlive) { g.Draw(ListBackgroundObject[B].ActiveTexture, ListBackgroundObject[B].Position, Color.White); } } Particule.Draw(g); for (int A = 0; A < EnemyAttack.ListEnemyAttack.Count; A++) { if (EnemyAttack.ListEnemyAttack[A].Resist > 0) { EnemyAttack.ListEnemyAttack[A].Draw(g); } } for (int E = 0; E < Enemy.ListEnemy.Count; E++) { if (Enemy.ListEnemy[E].IsAlive) { Enemy.ListEnemy[E].Draw(g); } } for (int S = 0; S < Smoke.ListSmoke.Count; S++) { if (Smoke.ListSmoke[S].IsAlive) { Smoke.ListSmoke[S].Draw(g); } } for (int P = 0; P < Explosion.ListExplosion.Count; P++) { if (Explosion.ListExplosion[P].IsAlive) { Explosion.ListExplosion[P].Draw(g); } } for (int E = 0; E < GroundExplosion.ListGroundExplosion.Count; E++) { if (GroundExplosion.ListGroundExplosion[E].IsAlive) { GroundExplosion.ListGroundExplosion[E].Draw(g); } } for (int T = 0; T < ListTimePanel.Count; T++) { g.Draw(sprTimePanel, ListTimePanel[T].Position, Color.White); g.DrawStringRightAligned(fntArial13, ListTimePanel[T].Text, new Vector2(ListTimePanel[T].Position.X + 55, ListTimePanel[T].Position.Y + 7), Color.White); } DrawPowerUps(g); for (int V = 0; V < Vehicule.ArrayVehicule.Length; V++) { Vehicule.ArrayVehicule[V].Draw(g); } DrawBase(g); }
public override void Update(GameTime gameTime) { for (int S = ListEnemySpawner.Count - 1; S >= 0; --S) { ListEnemySpawner[S].Update(gameTime); } SuperTank2.SlowDownSpecialActive = false; for (int V = 0; V < Vehicule.ArrayVehicule.Length; V++) { Vehicule.ArrayVehicule[V].BackgroundSpeed = new Vector2(Background2D.MoveSpeed.X, Background2D.MoveSpeed.Y); Vehicule.ArrayVehicule[V].Update(gameTime); } float TimeEllapsed = gameTime.ElapsedGameTime.Milliseconds * 0.0625f; if (SuperTank2.SlowDownSpecialActive) { TimeEllapsed *= 0.5f; } Background2D.Update(gameTime); for (int E = 0; E < Enemy.ListEnemy.Count; E++) { if (Enemy.ListEnemy[E].IsAlive) { Enemy.ListEnemy[E].Update(TimeEllapsed); for (int V = 0; V < Vehicule.ArrayVehicule.Length; V++) { if (Vehicule.ArrayVehicule[V].VehiculeResist > 0) { if (Enemy.ListEnemy[E].PixelIntersect(Vehicule.ArrayVehicule[V])) { sndHit.Play(); Enemy.ListEnemy[E].Resist -= 10; if (Enemy.ListEnemy[E].Resist <= 0) { Enemy.ListEnemy[E].Destroyed(Vehicule.ArrayVehicule[V]); } if (Vehicule.ArrayVehicule[V].Protec > 0) { Vehicule.ArrayVehicule[V].Protec -= 1; } else { Vehicule.ArrayVehicule[V].VehiculeResist -= 1; } } } } } } for (int A = 0; A < EnemyAttack.ListEnemyAttack.Count; A++) { if (EnemyAttack.ListEnemyAttack[A].Resist > 0) { EnemyAttack.ListEnemyAttack[A].Update(TimeEllapsed); for (int V = 0; V < Vehicule.ArrayVehicule.Length; V++) { if (Vehicule.ArrayVehicule[V].VehiculeResist > 0) { bool AttackHit; if (EnemyAttack.ListEnemyAttack[A].AttackType == EnemyAttack.AttackTypes.Laser) { AttackHit = EnemyAttack.ListEnemyAttack[A].CollisionBox.Intersects(Vehicule.ArrayVehicule[V].CollisionBox); } else { if (EnemyAttack.ListEnemyAttack[A].PixelIntersect(Vehicule.ArrayVehicule[V])) { EnemyAttack.ListEnemyAttack[A].Resist = 0; EnemyAttack.ListEnemyAttack[A].Destroyed(Vehicule.ArrayVehicule[V]); AttackHit = true; } else { AttackHit = false; } } if (AttackHit) { sndHit.Play(); Vehicule.ArrayVehicule[V].VehiculeResist -= EnemyAttack.ListEnemyAttack[A].Damage; for (int i = 0; i < EnemyAttack.ListEnemyAttack[A].Damage; i++) { new FlameParticle(EnemyAttack.ListEnemyAttack[A].Position, SuperTank2.Randomizer.Next(360) * SuperTank2.DegToRad, SuperTank2.Randomizer.NextDouble() * 5).AddParticule(); } } } } } } Particule.UpdateParticles(gameTime); for (int S = 0; S < Smoke.ListSmoke.Count; S++) { if (Smoke.ListSmoke[S].IsAlive) { Smoke.ListSmoke[S].Update(gameTime); } } for (int E = 0; E < Explosion.ListExplosion.Count; E++) { if (Explosion.ListExplosion[E].IsAlive) { Explosion.ListExplosion[E].Update(gameTime); } } for (int E = 0; E < GroundExplosion.ListGroundExplosion.Count; E++) { if (GroundExplosion.ListGroundExplosion[E].IsAlive) { GroundExplosion.ListGroundExplosion[E].Position.X -= Background2D.MoveSpeed.X; if (GroundExplosion.ListGroundExplosion[E].Position.X < -50) { GroundExplosion.ListGroundExplosion[E].IsAlive = false; } } } for (int B = 0; B < ListBackgroundObject.Count; B++) { if (ListBackgroundObject[B].IsAlive) { ListBackgroundObject[B].Position.X -= 5; if (ListBackgroundObject[B].Position.X < -200) { ListBackgroundObject[B].IsAlive = false; } } } for (int T = 0; T < ListTimePanel.Count; T++) { ListTimePanel[T].Position.X -= Background2D.MoveSpeed.X; if (ListTimePanel[T].Position.X < -50) { ListTimePanel.RemoveAt(T--); } } for (int P = 0; P < PowerUp.ListPowerUp.Count; P++) { if (PowerUp.ListPowerUp[P].VisibleTime > 0) { PowerUp.ListPowerUp[P].UpdateTransformationMatrix(); for (int V = 0; V < Vehicule.ArrayVehicule.Length; V++) { if (PowerUp.ListPowerUp[P].PixelIntersect(Vehicule.ArrayVehicule[V])) { if (Vehicule.ArrayVehicule[V].ActivatePowerUp(PowerUp.ListPowerUp[P].PowerUpType)) { PowerUp.ListPowerUp[P].VisibleTime = 0; } } } if (PowerUp.ListPowerUp[P].Position.Y > 750) { --PowerUp.ListPowerUp[P].VisibleTime; } else { PowerUp.ListPowerUp[P].Position.Y += 1; } } } if (TimeBeforeBoss % TimeBeforeTimePanel == 0 && TimeBeforeBoss > 0) { TimePanel NewTimePanel = new TimePanel(new Vector2(1024, 655)); NewTimePanel.Text = TimeBeforeBoss / TimeBeforeTimePanel + " km"; ListTimePanel.Add(NewTimePanel); } --TimeBeforeBoss; }