I'm trying to make a pong clone and am having trouble grasping ball deflection. The way I'm approaching it is to increase the angle by how far the ball collides from the middle of the paddle. However, I can't seem to get the math right and I've tried so many things that I'm beginning to doubt what I know.
The issue I'm running into is that I can get the angle I want in degrees, but I can't figure out the correct way to apply it to the velocity vector. Is there a way that I can take ANY angle and apply it evenly across the ball velocity?
For example, when the game starts I set the velocity to -5,5 so that it heads left. If I were to calculate the angle of deflection as 50 degrees, what operation am I looking at to apply that to the velocity? Converting degrees to radians won't work because that would create fractional numbers and my velocity and position are ints. I've considered just hardcoding ranges of distance from paddleY into different velocities, but I was hoping there might be a better way.