Example #1
0
        //click Play Again
        private void PicPlayAgain_Click(object sender, EventArgs e)
        {
            _snake.RemoveSnake();
            PanelEnd.Visible = false;
            _score           = 0;

            Lblscore.Text = string.Empty;
            if (_flag)
            {
                TimerShiftFood.Stop();
                TimerSpeed.Stop();
            }

            _snake            = new CSnake(ref _Frm_Main, Keys.D);
            _fLx              = _food._location.X;
            _fLy              = _food._location.Y;
            _Frm_Main.Visible = false;

            new Frm_Setting(ref _Frm_Main).ShowDialog();

            _Frm_Main.Visible = true;

            TimerSpeed.Interval = 1010 - ((_Speed - 1) * 50);
            if (_ShiftFood != 0)
            {
                TimerShiftFood.Interval = 10000 - ((_ShiftFood - 1) * 400);
                _flag = true;
            }
            else
            {
                _flag = false;
            }
        }
Example #2
0
 //Constructor
 public Frm_Main()
 {
     new Frm_Login().ShowDialog();
     _Frm_Main = this;
     InitializeComponent();
     PanelEnd.Dock    = DockStyle.Fill;
     PanelEnd.Visible = false;
     _food            = new CFood(ref _Frm_Main);
     _score           = 0;
     _snake           = new CSnake(ref _Frm_Main, Keys.D);
     _fLx             = _food._location.X;
     _fLy             = _food._location.Y;
     new Frm_Setting(ref _Frm_Main).ShowDialog();
     TimerSpeed.Interval = 1010 - ((_Speed - 1) * 50);
     if (_ShiftFood != 0)
     {
         TimerShiftFood.Interval = 10000 - ((_ShiftFood - 1) * 450);
         _flag = true;
     }
     else
     {
         _flag = false;
     }
 }