Exemplo n.º 1
0
        private void MoveObjects(object sender, EventArgs e)
        {
            player1.MoveBat();
            player2.MoveBat();
            ball.MoveBall();
            ball.CheckForCollision(player1, player2);

            string winner = ball.CheckForWinner();

            if (winner != null)
            {
                Console.WriteLine("the winner is " + winner);

                ball = new Ball(pbBall);

                if (winner == "p1")
                {
                    lblP1Score.Text = (Int32.Parse(lblP1Score.Text) + 1).ToString();
                }
                else
                {
                    lblP2Score.Text = (Int32.Parse(lblP2Score.Text) + 1).ToString();
                }
            }
        }