Exemple #1
0
        /**********************************************************
        * Name: Vashista Gande
        * Date: June 12th, 2016
        * Description: Makes boundaries of the game, when you win,
        *              and when you lose and also adds score and life
        * ********************************************************/
        public void checkWin()
        {
            for (int x = 0; x < 6; x++)
            {
                //Checks if the coins hit the boundary or the mat or jeene in easy level and give score according to that and takes away the life
                if (blnEasy == true)
                {
                    if ((picGoldCoin[x].Bounds).IntersectsWith(picJeene.Bounds))
                    {
                        intCoinxValue           = rdCoinxValue.Next(0, (this.Width - 44));
                        picGoldCoin[x].Location = new Point(intCoinxValue, intCoinVisibility);
                        intScore++;
                    }
                }

                if ((picGoldCoin[x].Bounds).IntersectsWith(picMat.Bounds))
                {
                    intCoinxValue           = rdCoinxValue.Next(0, (this.Width - 44));
                    picGoldCoin[x].Location = new Point(intCoinxValue, intCoinVisibility);
                    intScore++;
                }
                else if ((picGoldCoin[x].Bounds).IntersectsWith(picBoxBot.Bounds))
                {
                    intCoinxValue           = rdCoinxValue.Next(0, (this.Width - 44));
                    picGoldCoin[x].Location = new Point(intCoinxValue, intCoinVisibility);
                }

                if ((picRedGoldCoin[x].Bounds).IntersectsWith(picMat.Bounds))
                {
                    intCoinxValue = rdCoinxValue.Next(0, (this.Width - 44));
                    picRedGoldCoin[x].Location = new Point(intCoinxValue, intCoinVisibility);
                    intLife++;
                }
                else if ((picRedGoldCoin[x].Bounds).IntersectsWith(picBoxBot.Bounds))
                {
                    intCoinxValue = rdCoinxValue.Next(0, (this.Width - 50));
                    picRedGoldCoin[x].Location = new Point(intCoinxValue, intCoinVisibility);
                }


                int number = intScore;
                if (number >= 10 && number <= 99)
                {
                    int intOnes = number % 10;
                    for (int c = 0; c < 10; c++)
                    {
                        if (intOnes == c)
                        {
                            picScore3.Image = imgScore.Images[c];
                        }
                    }
                    while (number >= 10)
                    {
                        number = (number - (number % 10)) / 10;
                    }
                    for (int c = 0; c < 10; c++)
                    {
                        if (number == c)
                        {
                            picScore2.Image = imgScore.Images[c];
                        }
                    }
                }
                else if (number < 10)
                {
                    int intOnes = number % 10;
                    for (int c = 0; c < 10; c++)
                    {
                        if (intOnes == c)
                        {
                            picScore3.Image = imgScore.Images[c];
                        }
                    }
                }
                if (intLife == 1)
                {
                    picLife1.Visible = false;
                }
                else if (intLife == 2)
                {
                    picLife2.Visible = false;
                }
                else if (intLife == 3)
                {
                    picLife3.Visible = false;


                    HighScore.scoreWriter();
                    blnTimer = true;
                }
            }
            boost1Touch();
        }