Maybe an idea to work out the angle difference between the current angle and desired angle - so it would be able to adjust the angle gradually rather than trying to be exact. Depends if your project will allow for that, with gameplay I mean.
Like, once you have the joystick angle, get the sprite angle as well, and come up with a modification value and apply that to the sprite angle. I find this sort of gradual movement more pleasing - like instead of:
if you.rdir < you.dir then you.rdir = you.rdir + 5
if you.rdir > you.dir then you.rdir = you.rdir - 5
you might have:
diff#=you.rdir-you.dir
Now that's an angle, but without correcting for wraparound, so to fix that:
While diff#>180.0
diff#=diff#-360.0
Endwhile
While diff#<-180.0
diff#=diff#+360.0
Endwhile
Now diff# will be a value between -180.0 and 180.0 that you can apply to your you.rdir value to get the same instant movement. But if you limit it, you get gradual movement, like this:
If diff#<-3.0 then diff#=-3.0
If diff#>3.0 then diff#=3.0
Now it'll only rotate by a maximum of 3 degrees each frame.
So something like this, untested, but along these line:
if GetVirtualJoystickX(1)<>0 and GetVirtualJoystickY(1)<>0
you.dir = GetVirtualJoystickAngle(1)+90 `my own function
you.vel = GetVirtualJoystickMagnitude(1) `ditto
diff#=you.rdir-you.dir
While diff#>180.0
diff#=diff#-360.0
Endwhile
While diff#<-180.0
diff#=diff#+360.0
Endwhile
If diff#<-3.0 then diff#=-3.0
If diff#>3.0 then diff#=3.0
you.rdir=you.rdir+diff#
if you.rvel < you.vel then you.rvel = you.rvel + 0.1
if you.rvel > you.vel then you.rvel = you.rvel - 0.1
else
rvel = rvel + 0.5
endif
SetSpriteAngle(you.id,you.rdir)
SetSpritePosition(you.id,GetSpriteX(you.id)-(cos(you.rdir)*you.rvel),GetSpriteY(you.id)-(sin(you.rdir)*you.rvel))

I got a fever, and the only prescription, is more memes.
