예제 #1
0
 private void Picexit_Click(object sender, EventArgs e)
 {
     TM_NguoiHung.Dispose();
     TM_CotTruyen.Dispose();
     TM_BiaVang.Dispose();
     TM_RanDom.Dispose();
     Application.Exit();
 }
예제 #2
0
        private void TM_BiaVang_Tick(object sender, EventArgs e)
        {
            foreach (Control x in this.Controls)
            {
                if (x is PictureBox && x.Tag == "beer" && x.Visible == true)
                {
                    if (x.Top > 615)
                    {
                        x.Top = 12;

                        TM_RanDom.Start();
                    }
                    else
                    {
                        x.Top += speed;
                        if (x.Top > 300)
                        {
                            hotro.picbiavo(x.Left).Visible = false;
                        }
                    }
                }
                if (x is PictureBox && x.Tag == "beer")
                {
                    if (x.Bounds.IntersectsWith(pic_nguoi.Bounds))
                    {
                        x.Top = 12;
                        TM_RanDom.Start();
                        score++;
                    }
                    if (x.Top >= 590)
                    {
                        x.Top = 12;
                        TM_RanDom.Start();
                        miss++;
                        this.Controls.Add(hotro.picbiavo(x.Left));
                    }
                }
                speed          = hotro.tangtocdo(score, speed);
                lbl_score.Text = "Score :" + score;
                lbl_miss.Text  = "Missed :" + miss;
                if (miss >= 5)
                {
                    TM_BiaVang.Dispose();
                    TM_NguoiHung.Dispose();
                    TM_RanDom.Dispose();
                    GameOver();
                }
            }
        }
예제 #3
0
        private void TM_RanDom_Tick(object sender, EventArgs e)
        {
            int r = ran.Next(0, 4);

            if (r == 0)
            {
                hotro.displayPic(picb1, picb2, picb3, picb4);// hiện ảnh 1 , ẩn 3 ảnh sau
            }
            if (r == 1)
            {
                hotro.displayPic(picb2, picb1, picb3, picb4);
            }
            if (r == 2)
            {
                hotro.displayPic(picb3, picb2, picb1, picb4);
            }
            if (r == 3)
            {
                hotro.displayPic(picb4, picb2, picb3, picb1);
            }
            TM_RanDom.Stop();
            TM_BiaVang.Start();
        }
예제 #4
0
 private void Btn_Click(object sender, EventArgs e)
 {
     lbl_DisplayCotTruyen.Dispose(); // hủy lbl cốt truyện
     TM_RanDom.Start();              // chạy Timer random
     pic_pau_st.Visible = true;      // hiện ảnh startgame
     speed = 8;                      // quy định tốc độ =8
     foreach (Control x in this.Controls)
     {
         if (x is PictureBox && x.Tag == "beer")
         {
             x.Visible = true;
         }
         if (x is PictureBox && x.Tag == "car")
         {
             x.Visible = true;
         }
         if (x is Label && x.Tag == "bangdiem")
         {
             x.Visible = true;
         }
     }
     pic_nguoi.Visible = true;    // hiện pic người
     audiochayGame.PlayLooping(); // chạy audo
 }