...and before you post asking about Wrapvalue(), I'll save you a bit of time
To keep an angle in range of 0 and 360, it's not a simple matter of adding or subtracting 360 from a value if it goes out of range. You need to take into account how many times you have to do this. You could do this in a loop, but that would waste processing time.
This example should show how it's done:
text 0,0, "wrapvalue(1280) = " + str$( wrapvalue(1280) )
text 0,16, "MyWrapValue(1280) = " + str$( MyWrapValue(1280) )
text 0,48, "wrapvalue(-1760.5) = " + str$( wrapvalue(-1760.5) )
text 0,64, "MyWrapValue(-1760.5) = " + str$( MyWrapValue(-1760.5) )
wait key : end
function MyWrapValue(v#)
` remove multiple copies of 360 from v#
ang# = v# - (int(v# / 360) * 360)
` check to see if the result is a negative. If so then add 360
if ang# < 0.0 then ang# = ang# + 360
endfunction ang#
Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.