Example #1
0
        private void Menu_start_Click(object sender, EventArgs e)
        {
            this.Controls.Clear();
            play play = new play()
            {
                TopLevel = false, FormBorderStyle = FormBorderStyle.None
            };

            play.snake = new Snake();
            play.game  = new Game();
            this.Controls.Add(play);
            play.Show();
        }
Example #2
0
        //自定义函数
        private void New_Game()
        {
            timer1.Stop();
            this.Controls.Clear();
            play play = new play()
            {
                TopLevel = false, FormBorderStyle = FormBorderStyle.None
            };

            play.snake = new Snake();
            play.game  = new Game();
            game.LV_SET();
            this.Controls.Add(play);
            play.Show();
        }
Example #3
0
        private void LV_SET()
        {
            timer1.Stop();
            db.Update_Score(int.Parse(score.Text.ToString()));//分数
            MessageBox.Show("点击进入下一关");
            this.Controls.Clear();
            play play = new play()
            {
                TopLevel = false, FormBorderStyle = FormBorderStyle.None
            };

            play.snake       = new Snake();
            play.snake.Speed = snake.Speed - 80;
            play.game        = game;
            game.LV_SET();
            this.Controls.Add(play);
            play.Show();
        }
Example #4
0
        private void Game_Set(int level)//w
        {
            Snake snake = new Snake();
            Game  game  = new Game();

            game.Level = level;
            this.Controls.Clear();
            play play = new play()
            {
                TopLevel = false, FormBorderStyle = FormBorderStyle.None
            };

            play.game     = game;
            play.snake    = snake;
            game.MaxScore = game.Level * 20;
            snake.Speed   = 1000 - 80 * (game.Level - 1);
            this.Controls.Add(play);
            play.Show();
        }