Example #1
0
        public void GameStart(Boolean isStart)
        {
            if (isStart)
            {
                if (mnuGameSettingsEasy.Checked)
                {
                    game.Difficulty = game_level.Easy;
                }
                else
                {
                    game.Difficulty = game_level.Hard;
                }

                // reset game
                game.reposition_of_blocks();
                // copy the background image and place it to saveImage.
                copyImage();
                // reset menus
                mnuGameSettingsEasy.Enabled = false;
                mnuGameSettingsHard.Enabled = false;
                // reset status
                game_speed  = 1;
                level       = 1;
                score       = 0;
                total_lines = 0;
                // show status
                ShowStatus();
                // reset variables
                check_for_game_completion = false;
                check_for_game_over       = false;
                check_for_start_game      = true;
                // set current block
                PlayBlock(current_block, true);
                // initialize the timer.
                tmrGame.Interval = 1000;
                // start the game.
                tmrGame.Enabled = true;

                mnuGamePlay.Text = "&Stop";
            }
            else
            {
                // reset menus
                mnuGameSettingsEasy.Enabled = true;
                mnuGameSettingsHard.Enabled = true;
                // reset variables
                check_for_game_completion = false;
                check_for_game_over       = false;
                check_for_start_game      = false;
                // stop the game.
                check_for_start_game = false;
                tmrGame.Enabled      = false;

                mnuGamePlay.Text = "&Start";
            }
        }