home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / SlightOHand.dxr / Internal_13.ls < prev    next >
Encoding:
Text File  |  2002-01-31  |  2.8 KB  |  105 lines

  1. global gHands, gCupsToMove, gCupSprites, eatshit, gCounta, gCenterOfRotation, gAxisX, gAxisY, gFunk, speed, gPickCup, gCountaWhat, gBalls
  2.  
  3. on getRadians theDegrees
  4.   return theDegrees * PI / 180
  5. end
  6.  
  7. on getDegrees theRadians
  8.   return theRadians * 180.0 / PI
  9. end
  10.  
  11. on getRotationCenter aList
  12.   xC = float(aList[1].locH) + (abs(float(aList[1].locH) - float(aList[2].locH)) / 2.0)
  13.   yC = (float(aList[1].locV) + float(aList[2].locV)) / 2.0
  14.   return [xC, yC]
  15. end
  16.  
  17. on getAxis aList
  18.   return abs(aList[2].locH - aList[1].locH) / 2
  19. end
  20.  
  21. on getTwoRandomCups
  22.   the randomSeed = the ticks * 55.54999999999999716
  23.   cupsAvail = gCupSprites.duplicate()
  24.   gCupsToMove = []
  25.   repeat with i = 1 to 2
  26.     temp = cupsAvail[random(cupsAvail.count)]
  27.     cupsAvail.deleteOne(temp)
  28.     gCupsToMove.add(temp)
  29.   end repeat
  30.   gCupsToMove.sort()
  31.   moveCups()
  32. end
  33.  
  34. on moveCups
  35.   if gCupsToMove[1].locH > gCupsToMove[2].locH then
  36.     temp = gCupsToMove[1]
  37.     temp2 = gCupsToMove[2]
  38.     gCupsToMove.deleteAll()
  39.     gCupsToMove = [temp2, temp]
  40.   end if
  41.   gCupsToMove[1].oLoc = gCupsToMove[1].locV
  42.   gCupsToMove[2].oLoc = gCupsToMove[2].locV
  43.   gCenterOfRotation = getRotationCenter(gCupsToMove)
  44.   gAxisX = getAxis(gCupsToMove)
  45.   gAxisY = gAxisX
  46.   gCupsToMove[1].pAngle = getRadians(180)
  47.   gCupsToMove[2].pAngle = getRadians(0)
  48.   eatshit = 1
  49.   timeout("switch").new(50, #asslick)
  50. end
  51.  
  52. on asslick
  53.   if eatshit then
  54.     gCupsToMove[1].fuckYou(speed)
  55.     gCupsToMove[2].fuckYou(speed)
  56.     gHands[#right].loc = gCupsToMove[1].loc
  57.     gHands[#left].loc = gCupsToMove[2].loc
  58.     if (gCupsToMove[1].locV = gCupsToMove[1].oLoc) or (gCupsToMove[2].locV = gCupsToMove[2].oLoc) then
  59.       if (2 mod 2) = 0 then
  60.         eatshit = 0
  61.         if gCounta < gCountaWhat then
  62.           gCounta = gCounta + 1
  63.           getTwoRandomCups()
  64.           fuckOffShit()
  65.         else
  66.           puppetSound(8, 0)
  67.           gCounta = 0
  68.           gHands[#left].loc = gHands[#left].pOriginalLoc
  69.           gHands[#right].loc = gHands[#right].pOriginalLoc
  70.           timeout("switch").forget()
  71.           gPickCup = 1
  72.           if gCountaWhat < 18 then
  73.             gCountaWhat = gCountaWhat + 1
  74.           end if
  75.           if (gBalls.count mod 3) = 0 then
  76.             if speed < 40 then
  77.               speed = speed + 5
  78.             end if
  79.           end if
  80.         end if
  81.       end if
  82.     end if
  83.   end if
  84. end
  85.  
  86. on fuckOffShit
  87.   repeat while not fuckinCool()
  88.     if gHands[#right].locH > gCupsToMove[1].locH then
  89.       gHands[#right].locH = gHands[#right].locH - 20
  90.     end if
  91.     if gHands[#left].locH < gCupsToMove[2].locH then
  92.       gHands[#left].locH = gHands[#left].locH + 20
  93.     end if
  94.     updateStage()
  95.   end repeat
  96. end
  97.  
  98. on fuckinCool
  99.   if (gHands[#right].locH <= gCupsToMove[1].locH) and (gHands[#left].locH >= gCupsToMove[2].locH) then
  100.     return 1
  101.   else
  102.     return 0
  103.   end if
  104. end
  105.