Beispiel #1
0
        /// <summary>
        /// We enter this method when we click on the asteroid icon
        /// Check rigth or left button on the mouse is click and make some logic
        /// </summary>
        private void Asteroid_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right) // Rocket
            {
                if (Rocket.Count > 0 && !Rocket.IsFired && StartGame.IsStarted)
                {
                    Rocket.Count--;
                    RocketCount(Rocket.Count);
                    PlaySound.PlayMouseSound(e.Button);
                    Rocket.Fire(RocketPB, Height, BombPB.Left + BombPB.Width / 4);
                }
            }
            else
            {
                if (StartGame.IsStarted)
                {
                    PlaySound.PlayMouseSound(e.Button);
                    Bomb.Life--;
                    Laser.LightUp(LaserPB, e.X, BombPB, true);
                }
            }

            if (Bomb.IsExploding || Bomb.Life <= 0)
            {
                DestroyBomb();
            }
        }
Beispiel #2
0
 /// <summary>
 /// We enter this method when we click Somewhere on the screen
 /// Check rigth or left button on the mouse is click and make some logic
 /// </summary>
 private void AsteroidsForm_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (Rocket.Count > 0 && !Rocket.IsFired && StartGame.IsStarted)
         {
             int count = Rocket.Count--;
             RocketCount(count - 1);
             PlaySound.PlayMouseSound(e.Button);
             Rocket.Fire(RocketPB, Height, e.X);
         }
     }
     else
     {
         if (StartGame.IsStarted)
         {
             PlaySound.PlayMouseSound(e.Button);
             Laser.LightUp(LaserPB, e.X, BombPB, false);
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// We enter this method when we click on the gift icon
 /// Check rigth or left button on the mouse is click and make some logic
 /// </summary>
 private void RedGift_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if (Rocket.Count > 0 && !Rocket.IsFired && StartGame.IsStarted)
         {
             int count = Rocket.Count--;
             RocketCount(count - 1);
             ScoreCounter();
             PlaySound.PlayMouseSound(e.Button);
             Rocket.Fire(RocketPB, Height, RedGift.Left + RedGift.Width / 4);
         }
     }
     else
     {
         if (StartGame.IsStarted)
         {
             PlaySound.PlayMouseSound(e.Button);
             Laser.LightUp(LaserPB, Gift.X, RedGift, true);
             DestroyGift();
         }
     }
 }