Ejemplo n.º 1
0
 private void timer3_Tick(object sender, EventArgs e)
 {
     if (n > 0)
     {
         n--;
     }
     else
     {
         timer3.Stop();
         timer2.Stop();
         MessageBox.Show("Time Out!");
         n = 90;
         state4 b = new state4();
         b.Show();
         this.Hide();
     }
     stptimr.Text = n.ToString();
 }
Ejemplo n.º 2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (meatbox2.Bounds.IntersectsWith(dk1.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            else if (meatbox2.Bounds.IntersectsWith(dk2.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk5.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk6.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk7.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk10.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk11.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk12.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk30.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk14.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk17.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk16.Bounds))
            {
                timer1.Stop();
                timer2.Stop();
                timer3.Stop();
                dk16.Image = Properties.Resources.snake;

                MessageBox.Show("เคราะซ้ำกรรมซัด เจ้าโดนงูกัดตาย TT");

                meatbox2.Top  = 25;
                meatbox2.Left = 25;
                timer1.Start();
                timer2.Start();
                timer3.Start();
            }

            /*if (meatbox2.Bounds.IntersectsWith(dk15.Bounds))
             * {
             *  timer1.Stop();
             *  timer2.Stop();
             *  timer3.Stop();
             *  piramid.Stop();
             *
             *
             *
             *  MessageBox.Show("ดีใจด้วย สมบัติของเจ้าคือ เจ้าได้มีชีวิตรอด55555");
             *
             *
             *  timer1.Start();
             *  timer2.Start();
             *  timer3.Start();
             * }*/

            if (meatbox2.Bounds.IntersectsWith(dk18.Bounds))
            {
                timer1.Stop();
                timer2.Stop();
                timer3.Stop();
                MessageBox.Show("ข้าไม่ได้ถามรหัสวิชา ข้าถามเป็นรหัสแอสกี้ oop มันถูกแล้ว!!!");
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
                timer1.Start();
                timer2.Start();
                timer3.Start();
            }
            if (meatbox2.Bounds.IntersectsWith(dk19.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk20.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk21.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk22.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk23.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }
            if (meatbox2.Bounds.IntersectsWith(dk24.Bounds))
            {
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
            }


            else if (meatbox2.Bounds.IntersectsWith(Goal2.Bounds))
            {
                timer1.Stop();
                timer2.Stop();
                timer3.Stop();
                MessageBox.Show("Next state !");
                n             = 91;
                meatbox2.Top  = 25;
                meatbox2.Left = 25;
                state4 a = new state4();
                a.Show();
                this.Hide();
            }
        }