/// <summary> /// Handles the collision with the ball. it chooses a random angle in the same direction the ball was previously going /// and increase th eballs speed /// </summary> /// <param name="ball"></param> /// <param name="rand"></param> public void Collide(Ball ball, Random rand) { if (Active) { float direction = rand.Next(2) * 2 - 1; ; if (ball.Direction.X > 0) { direction = 1.0f; } else { direction = -1.0f; } Vector2 ballDirection = new Vector2(direction, (float)(rand.NextDouble() * 1.5 - 1)); ball.Boost(ballDirection, boostSpeed); Active = false; Timer += TimerDown; SpeedSound.Play(); } }