Exemple #1
0
        //Constructor
        public CSnake(ref Frm_Main _frm, Keys _keys)
        {
            this._frm  = _frm;
            this._keys = _keys;
            Bitmap _imagehead = Snake.Properties.Resources.HeadD;

            _head = new Point(10, 10);
            _body = new List <PictureBox>();
            Add();
            Add();
            Add();
        }
Exemple #2
0
 //Constructor
 public Frm_Setting(ref Frm_Main _frm)
 {
     InitializeComponent();
     this._frm = _frm;
     _head     = new Point(15, 230);
     _body     = new List <PictureBox>();
     Add();
     _body[0].BackColor = Color.Red;
     Add();
     Add();
     _frm._ShiftFood = TrBarShiftFood.Value;
     _frm._Speed     = TrBarSpeed.Value;
     Speed.Enabled   = true;
 }
Exemple #3
0
        //Constructor
        public CFood(ref Frm_Main _frm)
        {
            _food           = new PictureBox();
            _food.Size      = new System.Drawing.Size(20, 20);
            _food.BackColor = System.Drawing.Color.Transparent;
            _food.SizeMode  = System.Windows.Forms.PictureBoxSizeMode.Zoom;

            //_food.BackColor = System.Drawing.Color.Red;
            _height   = _frm.Size.Height - 60;
            _width    = _frm.Size.Width - 60;
            _location = Point.Empty;
            shift();
            _frm.Controls.Add(_food);
        }
Exemple #4
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;
     }
 }