Beispiel #1
0
 private void SetUpSingle()
 {
     rightBat = new AIBat(Content, new Vector2(screenWidth, screenHeight), false);
     leftBat = new Bat(Content, new Vector2(screenWidth, screenHeight), true);
 }
Beispiel #2
0
        private int CheckHitLocation(Bat bat)
        {
            int block = 0;

            if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 20)
                block = 1;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 10 * 2)
                block = 2;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 10 * 3)
                block = 3;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 10 * 4)
                block = 4;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 10 * 5)
                block = 5;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 10 * 6)
                block = 6;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 10 * 7)
                block = 7;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 10 * 8)
                block = 8;
            else if (ball.GetPosition().Y < bat.GetPosition().Y + bat.GetSize().Height / 20 * 19)
                block = 9;
            else
                block = 10;

            return block;
        }