Ejemplo n.º 1
0
        void timer_Tick(object sender, EventArgs e)
        {
            T.UpdatePosition();
            H.UpdatePosition();

            pictureBox1.Invalidate();

            if (T.DidYaBite(H) == true)
            {
                lboxCommentary.Items.Add("OUCH");
            }

            T.CheckOutofBounds();
            H.CheckOutofBounds();

            if (T.IsWinner() == true && H.IsWinner() == true)
            {
                timer.Stop();
                btnStartRace.Visible = true;
                lboxCommentary.Items.Add("It's a tie.");
                btnStartRace.Hide();
                btnPause.Hide();
            }
            else if (T.IsWinner() == true)
            {
                T.SetWinCount(T.GetWinCount() + 1);
                lblScoreT.Text = T.GetWinCount().ToString();
                timer.Stop();
                btnStartRace.Visible = true;
                lboxCommentary.Items.Add("TORTOISE WINS!!!!! YAY!!!!!");
                btnStartRace.Hide();
                btnPause.Hide();
            }
            else if (H.IsWinner() == true)
            {
                H.SetWinCount(H.GetWinCount() + 1);
                lblScoreH.Text = H.GetWinCount().ToString();
                timer.Stop();
                btnStartRace.Visible = true;
                lboxCommentary.Items.Add("Hare wins. Booooo");
                btnStartRace.Hide();
                btnPause.Hide();
            }
            else
            {
            }
        }