Hello, this is the code that will rotate sprite (spr) towards a location (Xdest# and Ydest#) when executed once every move. However the target angle calculation seems to be inaccurate so when the target angle is reached by the sprite the sprites angle will flicker slightly which is not very nice, or smooth to look at. Speed# is defined prior to this segment of code as 4
This is the current code
angle#=sprite angle(spr)
xDest#=waypoints(waypoint).x
yDest#=waypoints(waypoint).y
targetAngle#=wrapvalue(atanfull(xDest#-x#,y#-yDest#))
` targetAngle#=int(wrapvalue(targetAngle#-(targetAngle#*2)))
dif#=angle#-targetAngle#
dif#=wrapvalue(dif#)
print targetAngle#
if dif#<180 then dec angle#,speed#
if dif#>179 then inc angle#,speed#
if dif#<speed# then angle#=targetAngle#
angle#=wrapvalue(angle#)
rotate sprite spr,angle#
move sprite spr,speed#
Any ideas chief?