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

  1. property pCup, spriteNum, pOriginalLoc, pTimeout, pOriginalMember, oLoc, pLocation, pCenterOfRotation, pAngle, pAxisX, pAxisY, eatshit
  2. global gCup, gCupSprites, gCupsToMove, gPickCup, gBalls, gBallInPlay, gGameEnd, gProceed, gHands, gI, gCenterOfRotation, gAxisX, gAxisY, fuctUp, gMisses
  3.  
  4. on beginSprite me
  5.   gI = 0
  6.   pCup = sprite(spriteNum)
  7.   pOriginalLoc = pCup.loc
  8.   pCup.visible = 1
  9.   gCupSprites.add(pCup)
  10.   pOriginalMember = pCup.member
  11.   if gCupSprites.count = 2 then
  12.     gCup = sprite(spriteNum)
  13.   end if
  14.   eatshit = 0
  15. end
  16.  
  17. on coverBall me
  18.   if not voidp(gBallInPlay) then
  19.     pTimeout = timeout(string(the ticks + spriteNum)).new(5, #moveOverBall, me)
  20.   end if
  21. end
  22.  
  23. on moveOverBall me
  24.   if pCup.locV < gBallInPlay.locV then
  25.     if pCup.locV < gBallInPlay.locV then
  26.       pCup.locV = pCup.locV + 5
  27.     end if
  28.   else
  29.     pTimeout.forget()
  30.     gHands[#left].member = member("left")
  31.     pCup.member = pOriginalMember
  32.     pCup.visible = 1
  33.     gBallInPlay.blend = 0
  34.     pTimeout = timeout(string(the ticks + spriteNum)).new(5, #moveBackToOriginalPos, me)
  35.     gBallInPlay.pTimeout = timeout(string(the ticks + gBallInPlay.spriteNum)).new(1, #followCup, gBallInPlay)
  36.   end if
  37. end
  38.  
  39. on moveBackToOriginalPos me
  40.   if pCup.loc > pOriginalLoc then
  41.     pCup.locV = pCup.locV - 5
  42.   else
  43.     pTimeout.forget()
  44.     puppetSound(8, member("roll"))
  45.     getTwoRandomCups()
  46.   end if
  47. end
  48.  
  49. on fuckYou me, ass
  50.   pAngle = pAngle + getRadians(ass)
  51.   newX = cos(pAngle) * gAxisX
  52.   newY = sin(pAngle) * gAxisY
  53.   pLocation = gCenterOfRotation + [newX, newY]
  54.   pCup.loc = point(pLocation[1], pLocation[2])
  55. end
  56.  
  57. on mouseDown me
  58.   if gPickCup then
  59.     gBallInPlay.blend = 100
  60.     gHands[#left].loc = pCup.loc
  61.     pCup.visible = 0
  62.     repeat with i = 1 to 9
  63.       gHands[#left].member = member("arm" & i)
  64.       s = the ticks + 1
  65.       repeat while the ticks < s
  66.         updateStage()
  67.       end repeat
  68.     end repeat
  69.     gPickCup = 0
  70.     if pCup = gCup then
  71.       s = the ticks + 25
  72.       repeat while the ticks < s
  73.         updateStage()
  74.       end repeat
  75.       gBallInPlay.throwOut(#player)
  76.     else
  77.       s = the ticks + 50
  78.       repeat while the ticks < s
  79.         updateStage()
  80.       end repeat
  81.       repeat with i = 9 down to 1
  82.         gHands[#left].member = member("arm" & i)
  83.         s = the ticks + 1
  84.         repeat while the ticks < s
  85.           updateStage()
  86.         end repeat
  87.       end repeat
  88.       pCup.visible = 1
  89.       gCup.visible = 0
  90.       gHands[#left].member = member("left")
  91.       gHands[#left].loc = gCup.loc
  92.       repeat with i = 1 to 9
  93.         gHands[#left].member = member("arm" & i)
  94.         s = the ticks + 1
  95.         repeat while the ticks < s
  96.           updateStage()
  97.         end repeat
  98.       end repeat
  99.       gBallInPlay.throwOut(#dealer)
  100.     end if
  101.     repeat with i in gCupSprites
  102.       i.loc = i.pOriginalLoc
  103.       if gCupSprites.findPos(i) <> 2 then
  104.         i.member = i.pOriginalMember
  105.       end if
  106.     end repeat
  107.     if gMisses < 3 then
  108.       fuctUp.visible = 1
  109.       gProceed = 1
  110.     end if
  111.   end if
  112. end
  113.  
  114. on showABall me
  115.   pTimeout.forget()
  116.   gCup.locV = gCup.locV - 25
  117.   gCup.member = member("cup down")
  118.   gBallInPlay.throwOut(#dealer)
  119. end
  120.  
  121. on gameOver me
  122.   gGameEnd.forget()
  123.   go("game over")
  124. end
  125.