Пример #1
0
        //checks who won the game
        private void whoWon(Player player1, Player player2)
        {
            //player1 wins
            if (player1.getScore() > player2.getScore())
                {
                winner = player1;
                loser = player2;
                }

            //player2 wins
            else if (player2.getScore() > player1.getScore())
                {
                winner = player2;
                loser = player1;
                }

            //the game ends in a tie
            else
                {
                tie = true;
                winner = player1;
                }
        }
Пример #2
0
 //draws the scores of given players with given sprite batch and font
 public void draw(SpriteBatch spriteBatch, SpriteFont font, Player player1, Player player2)
 {
     spriteBatch.DrawString(font, player1.getName() + ": " + player1.getScore(), p1, Color.White);
     spriteBatch.DrawString(font, player2.getName() + ": " + player2.getScore(), p2, Color.White);
 }