Here’s some pseudo code to do the bounce. The only trig has to do with the collision normal. The normal is perpendicular to the angle of the platform. So if you know the angle of the surface it’s enough to subtract 90 to get a perpendicular angle. Then to make the math look cleaner we can convert that angle to a vector.
Anyways here’s the math.
Nx,ny is the normal vector and can be calculated with:
nx= cos(plat.angle-90)
ny=sin(plat.angle-90)
Next we calculate the velocity along the normal’s direction. Here vn is that velocity, and vx, vy is the x and y velocity of the object. We are utilizing a vector dot product to get the velocity along the normal’s direction.
vn=vx*nx+vy*ny
So far so good. Next is to do the bounce by changing the velocity.
You only need to do the bounce if the object is going toward the platform.
Then the bounce is done by taking the velocity along the normal, converting it back to a vector by multiplying it by the normal, and finally subtracting that twice from the velocity. If you subtracted just once, then it would just stop motion in the direction of the normal.
if(vn >0)
vx = vx -2*vn*nx
vy = vy -2*vn*ny