Example #1
0
 private void MoveBullet(Bullet bullet)
 {
     bullet.AddY(bullet.Speed);
     traffic.ForEach(c =>
     {
         if (c.Area.IntersectsWith(bullet.Area))
         {
             SpawnExplosion(c);
             ResetCar(c);
             bullet.Active = false;
         }
     });
     if (bullet.Area.IntersectsWith(player.Area))
     {
         SpawnExplosion(player);
         bullet.Active = false;
         LowerPlayerHealth();
         if (player.Area.Y >= GameWindowConfig.WindowHeight)
         {
             GameOver();
         }
     }
     if (bullet.Area.IntersectsWith(enemy.Area))
     {
         SpawnExplosion(enemy);
         bullet.Active = false;
         enemy.Health -= 1;
         if (enemy.Health <= 0)
         {
             bossSequence = false;
         }
     }
 }