home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / BeaverFever.dxr / 00006.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.9 KB  |  87 lines

  1. on harvestInput
  2.   global inputString
  3.   inputString = [0, 0, 0, 0, 0, 0, 0]
  4.   if keyPressed(0) = 1 then
  5.     inputString[1] = 1
  6.   end if
  7.   if keyPressed(2) = 1 then
  8.     inputString[2] = 1
  9.   end if
  10.   if keyPressed(1) = 1 then
  11.     inputString[3] = 1
  12.   end if
  13.   if keyPressed(13) = 1 then
  14.     inputString[4] = 1
  15.   end if
  16.   if keyPressed(123) = 1 then
  17.     inputString[1] = 1
  18.   end if
  19.   if keyPressed(124) = 1 then
  20.     inputString[2] = 1
  21.   end if
  22.   if keyPressed(125) = 1 then
  23.     inputString[3] = 1
  24.   end if
  25.   if keyPressed(126) = 1 then
  26.     inputString[4] = 1
  27.   end if
  28. end
  29.  
  30. on findDistance pointA, pointB
  31.   hDistance = pointA[1] - pointB[1]
  32.   vDistance = pointA[2] - pointB[2]
  33.   finalDistance = sqrt((hDistance * hDistance) + (vDistance * vDistance))
  34.   return finalDistance
  35. end
  36.  
  37. on findAngle pointA, pointB
  38.   global watchThisAngle
  39.   xDist = pointB[1] - pointA[1]
  40.   yDist = pointB[2] - pointA[2]
  41.   if xDist <> 0 then
  42.     watchThisAngle = atan(1.0 * yDist / xDist) * 180 / PI
  43.     theAngle = atan(1.0 * yDist / xDist) * 180 / PI
  44.     if xDist > 0 then
  45.       theAngle = theAngle + 90
  46.     else
  47.       if xDist < 0 then
  48.         theAngle = theAngle - 90
  49.       else
  50.         if yDist < 0 then
  51.           theAngle = 0
  52.         else
  53.           if yDist > 0 then
  54.             theAngle = 180
  55.           end if
  56.         end if
  57.       end if
  58.     end if
  59.   else
  60.     if yDist < 0 then
  61.       theAngle = 0
  62.     else
  63.       if yDist > 0 then
  64.         theAngle = 180
  65.       end if
  66.     end if
  67.   end if
  68.   return theAngle
  69. end
  70.  
  71. on ticksToTime ticktimer
  72.   ticks_Value = ticktimer mod 30
  73.   remainingValue = ticktimer - ticks_Value
  74.   remainingValue = remainingValue / 30
  75.   seconds_Value = remainingValue mod 60
  76.   remainingValue = remainingValue - ticks_Value
  77.   remainingValue = remainingValue / 60
  78.   return [ticks_Value, seconds_Value, remainingValue]
  79. end
  80.  
  81. on playSound whichSound, whichSlot
  82.   global lastClear
  83.   sound(whichSlot).stop()
  84.   sound(whichSlot).queue([#member: member(whichSound)])
  85.   sound(whichSlot).play()
  86. end
  87.