Beispiel #1
0
        private void Shooter_btn_Click(object sender, EventArgs e)
        {
            //below code is for sound and gif

            Image img = Image.FromFile(@"C:\Users\LENOVO\source\repos\skattar\res\shoot.gif");

            pbox.Image = img;
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"C:\Users\LENOVO\source\repos\skattar\res\shoot.wav");
            player.Play();
            shoot ShotObj = new shoot();                                          //this is the object of shoot class
            int   points  = ShotObj.shooterr(obj_shoot.loaded, obj_shoot.Spined); //this caliing the method from shooter class


            if (chance == 0 && points == 10)                           //this is a if else statement
            {
                MessageBox.Show("Winner and your score is " + points); //this is for the meesge pop up
                Shooter_btn.Enabled = false;
            }

            else if (chance == 1 && points == 5)
            {
                MessageBox.Show("Winner and your score is " + points);//this is for the meesge pop up
                Shooter_btn.Enabled = false;
            }
            if (chance == 1 && points == 0)
            {
                MessageBox.Show("You loose");//this is for the meesge pop up
                Shooter_btn.Enabled = false;
            }
            else
            {
                chance++;
                Spined = spinchamber(Spined);
            }
        }
Beispiel #2
0
        private void Spined_btn_Click(object sender, EventArgs e)
        {             //below code is for sound and gif
            Image img = Image.FromFile(@"C:\Users\LENOVO\source\repos\skattar\res\spin.gif");

            pbox.Image = img;
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"C:\Users\LENOVO\source\repos\skattar\res\spin.wav");
            player.Play();
            shoot SpinObj = new shoot();

            obj_shoot.Spined = SpinObj.Spin_Chamber();
            // below code is for enableling and disableing the button
            Shooter_btn.Enabled = true;
            Spined_btn.Enabled  = false;
        }