You could make the smoothing (less "hacky", I suppose) by defining a rotation speed angularVelocity
, and then apply the speed with the delta (e.g., rotation_degress += delta * angularVelocity
, so even if your game lags the rotation will appear smooth.
If your game requires the player's sprite rotation to determine hitboxes (shooting) or what not, you could apply the solution proposed by BardlaAB87 to achieve visual smoothness, but keep track of a seperate variable (e.g. actualSpriteRotation
), so mechanically the player would instantly snap 90 degrees (you would do actualSpriteRotation += 90
), allowing for immediate accurate actions based on sprite rotation angle, but the sprite would be visually catching up by rotating the sprite towards the actualSpriteRotation
angle