コード例 #1
0
ファイル: Form1.cs プロジェクト: deanzhang380/Game
 private void Start_Btn_Click(object sender, EventArgs e)
 {
     flag_GameStart = true;
     if (flag_GameStart == true)
     {
         MenuPanel.Hide();
         Screen.Enabled = false;
     }
     Game_Timer.Start();
 }
コード例 #2
0
        void StartTraining()
        {
            PipesPics = new List <Tuple <PictureBox, PictureBox> >();
            BirdsPics = new List <PictureBox>();
            var bmp = new Bitmap(FlappyBird_AI.Properties.Resources.bird);

            Game_Timer.Interval = 1;
            Game_Timer.Start();
            for (int i = 0; i < 5; i++)
            {
                var        bmp1  = new Bitmap(FlappyBird_AI.Properties.Resources.pipe);
                PictureBox pipe1 = new PictureBox();
                pipe1.Image     = bmp1;
                pipe1.BackColor = Color.Transparent;
                pipe1.SizeMode  = PictureBoxSizeMode.StretchImage;
                pipe1.Location  = new Point(0, 0);
                pipe1.Size      = new System.Drawing.Size(0, 0);
                pictureBox2.Controls.Add(pipe1);
                //Upper
                var        bmp2  = new Bitmap(FlappyBird_AI.Properties.Resources.pipedown);
                PictureBox pipe2 = new PictureBox();
                pipe2.Image     = bmp2;
                pipe2.BackColor = Color.Transparent;
                pipe2.SizeMode  = PictureBoxSizeMode.StretchImage;
                pipe2.Location  = new Point(0, 0);
                pipe2.Size      = new System.Drawing.Size(0, 0);
                pictureBox2.Controls.Add(pipe2);
                PipesPics.Add(new Tuple <PictureBox, PictureBox>(pipe1, pipe2));
            }
            for (int i = 0; i < Fb.PopulationNumber; i++)
            {
                PictureBox p = new PictureBox();
                p.Image     = bmp;
                p.BackColor = Color.Transparent;
                p.Location  = new Point(34, 144);
                p.Size      = new System.Drawing.Size(25, 25);
                p.SizeMode  = PictureBoxSizeMode.StretchImage;
                pictureBox2.Controls.Add(p);
                BirdsPics.Add(p);
            }
        }
コード例 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     Game_Timer.Start();
 }