Exemplo n.º 1
0
        private void fnshMainTm()
        {
            if (lblMinutes.Text != "0")
            {
                lblSeconds.Text = Convert.ToString((Convert.ToInt32(lblSeconds.Text) - 1));

                if (lblSeconds.Text == "0")
                {
                    lblSeconds.Text = "59";
                    lblMinutes.Text = Convert.ToString(Convert.ToInt32(lblMinutes.Text) - 1);
                }
            }
            else
            {
                if (lblSeconds.Text == "0")
                {
                    finishGameTm.Stop();

                    if (DialogResult.OK == MessageBox.Show("Times Up..."))
                    {
                        hideForm();
                        frmScores.scores.Add(str);
                        frmScores frmScr = new frmScores();
                        frmScr.ShowDialog();
                    }
                }
                else
                {
                    lblSeconds.Text = Convert.ToString((Convert.ToInt32(lblSeconds.Text) - 1));
                }
            }
        }
Exemplo n.º 2
0
        // Call scores form to display results
        private void callScores()
        {
            frmScores frmScr = new frmScores();

            frmScr.ShowDialog();
        }
Exemplo n.º 3
0
        private void gmTm_Tick(object sender, EventArgs e)
        {
            label1.Text = Convert.ToString(score);

            if (goleft == true && picBascket.Left > 0)
            {
                picBascket.Left -= 12;
            }
            if (goright == true && picBascket.Left + picBascket.Width < this.ClientSize.Width)
            {
                picBascket.Left += 12;
            }

            if (lblSeconds.Text == "0" && lblMinutes.Text == "0")
            {
                gmTm.Stop();
            }

            foreach (Control X in this.Controls)
            {
                if (X is PictureBox && (string)X.Tag == "Apple")
                {
                    X.Top += speed;
                    if (X.Top + X.Height > this.ClientSize.Height)
                    {
                        splash.Location  = X.Location;
                        splash.Height    = 59;
                        splash.Width     = 60;
                        splash.BackColor = System.Drawing.Color.Transparent;
                        this.Controls.Add(splash);
                        X.Top  = rndY.Next(80, 300) * -1;
                        X.Left = rndX.Next(5, this.ClientSize.Width - X.Width);
                        missed++;
                    }

                    if (X.Bounds.IntersectsWith(picBascket.Bounds))
                    {
                        X.Top  = rndY.Next(100, 300) * -1;
                        X.Left = rndX.Next(5, this.ClientSize.Width - X.Width);
                        score++;
                    }

                    if (score > 20)
                    {
                        speed            = 16;
                        picBascket.Image = Properties.Resources.cartFull;
                    }
                }

                if (gamLvl == 1)
                {
                    if (X is PictureBox && (string)X.Tag == "bomb")
                    {
                        X.Visible = true;
                        speed     = 16;
                        X.Top    += speed;
                        if (X.Top + X.Height > this.ClientSize.Height)
                        {
                            splash.Location  = X.Location;
                            splash.Height    = 30;
                            splash.Width     = 30;
                            splash.BackColor = System.Drawing.Color.Transparent;
                            this.Controls.Add(splash);
                            X.Top  = rndY.Next(80, 300) * -1;
                            X.Left = rndX.Next(5, this.ClientSize.Width - X.Width);
                            missed++;
                        }

                        if (X.Bounds.IntersectsWith(picBascket.Bounds))
                        {
                            gmTm.Stop();
                            finishGameTm.Stop();
                            picGameOver.Visible = true;

                            if (DialogResult.OK == MessageBox.Show("Game Over..."))
                            {
                                hideForm();
                                frmScores.scores.Add(str);
                                frmScores frmScr = new frmScores();
                                frmScr.ShowDialog();
                            }
                        }

                        if (score > 15)
                        {
                            speed            = 25;
                            picBascket.Image = Properties.Resources.cartFull;
                        }
                    }
                }
            }
        }