Esempio n. 1
0
 public void Enemy_Die()
 {
     if (game.Enemy_List != null)
     {
         foreach (Enemy enemy in game.Enemy_List)
         {
             foreach (Bullet bullet in game.player.Bullet_List)
             {
                 if (enemy.enemy_rec.Intersects(bullet.Rec_ball))
                 {
                     enemy.is_alive = false;
                     bullet.Is_Visible = false;
                     int particle_generated = 100;
                     Random rand = new Random();
                     while (particle_generated > 0)
                     {
                         Particle new_particle = new Particle(game);
                         new_particle.Texture = Resources.texture_blood;
                         new_particle.Position = enemy.position;
                         new_particle.Velocity = new Vector2((float)rand.NextDouble() * 2 - 1, (float)rand.NextDouble() * 2 - 1);
                         new_particle.Angle = 0;
                         new_particle.TDV = 10;
                         new_particle.AngularVelocity = 0.1f * (float)(rand.NextDouble() * 2 - 1);
                         game.Particle_list.Add(new_particle);
                         particle_generated--;
                     }
                 }
             }
         }
             for (int i = 0; i < game.Enemy_List.Count; i++)
             {
                 Enemy listed_enemy = game.Enemy_List[i];
                 if (!listed_enemy.is_alive)
                 {
                     game.Enemy_List.RemoveAt(i);
                     i--;
                 }
             }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     base.Initialize();
     player = new Player(this);
     bullet = new Bullet(this);
     weapon = new Weapons(this);
     particle = new Particle(this);
     Enemy_List = new List<Enemy>();
     Particle_list = new List<Particle>();
     enemy = new Enemy(this);
     player.Initialize();
     bullet.Initialize();
     enemy.Initialize();
     camera = new Camera(GraphicsDevice.Viewport, this);
     map1 = new Map();
     map1.Generate(map1.Create_Map(0), 32);
 }