Optimising Challenge

BlitzMax Forums/BlitzMax Programming/Optimising Challenge

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Not tested but should work
Function Tween#( ang1#,ang2#,tween# )
   local d1#,d2#
   if ang1>ang2
          d1 = ang1-ang2
         d2 = 360-ang1+ang2
         if d1<d2
               return ang1-d1*tween
         else
              return ang1+(d2*tween) mod 360
        endif
   else
         d1 = ang2-ang1
         d2 = 360-ang2+ang1
         if d1<d2
              return ang2-d1*tween
         else
              return ang2+(d2*tween) mod 360
         endif 
   endif
end function