Smoother Sprite 2D turret rotation (slerp?)

So I am making a turret, that targets enemy units as they are walking past the turret. Everything is in 2D (isometric view).

I have basically made it so the turret basically “follows”/rotates when a enemy unit walks past it, however once the turret needs to go back to next target next minion, it instantly jumps to that frame.

For example, I have sprites at 5 degree intervals, all the way around. So a minion walks by, and the turret rotates to 90 degrees. Then another enemy comes and is at 270 degrees, the tower will instantly FLIP to 270…I want it to run/have a smooth animation from 90-270 degrees.

So I am trying to use SLERP (with locked x and z axis), however slerp only rotates my static image…and that in random x/y/z directions even though I have them locked.

My question is what can I do to achieve the smoother animation above from a case such as 90 degrees to 270 degrees and not jump?

let’s say that your current rotation is in 90, and targetAngle is 90. You can add a variable turnSpeed and then use this code in your Update…

float targetAngle = 90;
float turnSpeed = 5;
transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.Euler (0, 0, targetAngle), turnSpeed * Time.deltaTime);