home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / CheckersSparse.dxr / 00012.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  914 b   |  41 lines

  1. on findDistance pointA, pointB
  2.   hDistance = pointA[1] - pointB[1]
  3.   vDistance = pointA[2] - pointB[2]
  4.   finalDistance = sqrt((hDistance * hDistance) + (vDistance * vDistance))
  5.   return finalDistance
  6. end
  7.  
  8. on findAngle pointA, pointB
  9.   global watchThisAngle
  10.   xDist = pointB[1] - pointA[1]
  11.   yDist = pointB[2] - pointA[2]
  12.   if xDist <> 0 then
  13.     watchThisAngle = atan(1.0 * yDist / xDist) * 180 / PI
  14.     theAngle = atan(1.0 * yDist / xDist) * 180 / PI
  15.     if xDist > 0 then
  16.       theAngle = theAngle + 90
  17.     else
  18.       if xDist < 0 then
  19.         theAngle = theAngle - 90
  20.       else
  21.         if yDist < 0 then
  22.           theAngle = 0
  23.         else
  24.           if yDist > 0 then
  25.             theAngle = 180
  26.           end if
  27.         end if
  28.       end if
  29.     end if
  30.   else
  31.     if yDist < 0 then
  32.       theAngle = 0
  33.     else
  34.       if yDist > 0 then
  35.         theAngle = 180
  36.       end if
  37.     end if
  38.   end if
  39.   return theAngle
  40. end
  41.