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

  1. property pBall, spriteNum, pOriginalLoc, pTimeout
  2. global gBalls, gBallInPlay, gCup, gButton, gHands, gCountaWhat, gSpinCup, gMisses
  3.  
  4. on beginSprite me
  5.   pBall = sprite(spriteNum)
  6.   pBall.visible = 1
  7.   pOriginalLoc = pBall.loc
  8.   gBalls.add(pBall)
  9. end
  10.  
  11. on putIntoPlay me
  12.   gBallInPlay = sprite(spriteNum)
  13.   gBallInPlay.loc = point((the stage).rect.width / 2, ((the stage).rect.height / 2) + 100)
  14.   gHands[#left].pushCup()
  15. end
  16.  
  17. on throwOut me, who
  18.   pTimeout.forget()
  19.   if who = #player then
  20.     y9 = float(gButton[who].locV) - float(pBall.locV)
  21.     x9 = float(gButton[who].locH) - float(pBall.locH)
  22.     pLocation = [float(pBall.locH), float(pBall.locV)]
  23.     theAng = atan(abs(y9 / x9))
  24.     put theAng
  25.     repeat while pBall.loc <> gButton[who].loc
  26.       xPos = -cos(theAng) * 1.0
  27.       yPos = sin(theAng) * 1.0
  28.       if yPos < 0 then
  29.         yPos = -yPos
  30.       end if
  31.       pLocation = pLocation + [xPos, yPos]
  32.       pBall.loc = point(pLocation[1], pLocation[2])
  33.       updateStage()
  34.     end repeat
  35.     gCup.visible = 1
  36.     gHands[#left].member = member("left")
  37.     gHands[#left].loc = gHands[#left].pOriginalLoc
  38.     xtc = value(member(string(who) && "score").text)
  39.     puppetSound(4, member("right bowl"))
  40.     member(string(who) && "score").text = string(xtc + (5 * gCountaWhat))
  41.     pBall.loc = point(-100, -100)
  42.   else
  43.     y9 = float(gSpinCup[gMisses + 1].locV) - float(pBall.locV)
  44.     x9 = float(gSpinCup[gMisses + 1].locH) - float(pBall.locH)
  45.     pLocation = [float(pBall.locH), float(pBall.locV)]
  46.     theAng = atan(abs(y9 / x9))
  47.     repeat while pBall.loc <> gSpinCup[gMisses + 1].loc
  48.       xPos = cos(theAng) * 1.0
  49.       yPos = -sin(theAng) * 1.0
  50.       if yPos < 0 then
  51.         yPos = -yPos
  52.       end if
  53.       pLocation = pLocation + [xPos, yPos]
  54.       pBall.loc = point(pLocation[1], pLocation[2])
  55.       updateStage()
  56.     end repeat
  57.     gMisses = gMisses + 1
  58.     puppetSound(4, member("wrong bowl"))
  59.     gSpinCup[gMisses].krazyKool()
  60.     gCup.visible = 1
  61.     gHands[#left].member = member("left")
  62.     gHands[#left].loc = gHands[#left].pOriginalLoc
  63.     pBall.loc = point(-100, -100)
  64.   end if
  65. end
  66.  
  67. on followCup me
  68.   pBall.loc = gCup.loc
  69. end
  70.