Exemple #1
0
        private void timerLevel_Tick(object sender, EventArgs e)
        {
            int min = timer/60;
            int seconds = timer%60;
            if (timer == 0)
            {

                this.Hide();
                HighScore highScore = new HighScore(font, titleFont,points);
                highScore.ShowDialog();
                this.Close();
            }

            lblTimer.Text = min + ":" + seconds;
            timer--;
        }
Exemple #2
0
        public void newTriangle()
        {
            int count = 0;
            int crveni = 0;
            for (int i = 0; i < 5; ++i)
            {
                for (int j = 0; j < 5; j++)
                {
                    if (matrix[i, j].Orientation == 0)
                        count++;

                    if (matrix[i, j].Orientation == 6)
                        crveni++;

                }
            }

            if (checkSQ())
            {

                this.newGame.Hide();

                HighScore highScore = new HighScore(font, titleFont, newGame.points);
                highScore.ShowDialog();

                newGame.Close();
            }

            if (count == 1)
            {

                newGame.Hide();
                HighScore highScore = new HighScore(font, titleFont, newGame.points);
                highScore.ShowDialog();
                newGame.Close();
                //MessageBox.Show("GAME OVER !");
            }

            Random r = new Random();
            int next = r.Next(count);
            int x = r.Next(4);
            for (int i = 0; i < 5; ++i)
            {
                for (int j = 0; j < 5; j++)
                {

                    if (matrix[i, j].Orientation == 0)
                    {
                        next--;
                        if (next == 0)
                        {
                            matrix[i, j] = new Shape(x + 1);

                        }
                    }
                }
            }
        }