public GameEngine()
 {
     playerOne = new Player(false, true);
     playerTwo = new Player(true, false);
     ball = new PongBall();
     multiplayer = false;
 }
        public void CheckPlayerCollision(Player player, PongBall ball)
        {
            Random rand = new Random();
            float[] deflectionSlopes = new float[] { -.8f, -.5f, -.15f, .15f, .5f, .8f };
            for (int i = 0; i < 6; i++)
            {
                if (collisionCooldown == 0)
                {
                    if (player.collisionBoxes[i].Intersects(ball.position))
                    {
                        //player.PlayCollisionSound();
                        SwitchDirection();
                        if (player.leftSidePlayer)
                            slope = deflectionSlopes[i];
                        else
                            slope = -deflectionSlopes[i];

                        yIntercept = (int)(position.Y - (slope * position.X));
                        collisionCooldown++;
                        break;
                    }
                }
                else
                {
                    collisionCooldown++;
                    if (collisionCooldown >= 60)
                        collisionCooldown = 0;
                }

            }
        }
 public void MovePlayer(Player player, PongBall ball)
 {
     int speed = ball.speed/2+3;
     int playerTopPoint = player.position.Y;
     int playerBottomPoint = player.position.Y + player.position.Height;
     if (!((ball.position.Y > playerTopPoint) && (ball.position.Y < playerBottomPoint)))
     {
         if (ball.position.Y > playerBottomPoint)
             player.position.Y += speed;
         if (ball.position.Y < playerTopPoint)
             player.position.Y -= speed;
     }
 }
        public void CheckPastPlayer(Player leftSide, Player rightSide)
        {
            if ((position.X + position.Width + 5 ) < 0)     //Goes beyond leftSide player (playerOne)
            {
                rightSide.score += 1;
                isAlive = false;
                drawBall = false;
                //TODO: play sound for player scoring
            }

            if ((position.X + 5) > GameBase.monitorWidth)   //Goes beyond rightSide player (playerTwo)
            {
                leftSide.score += 1;
                isAlive = false;
                drawBall = false;
                //TODO: play sound for player scoring
            }
        }