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

  1. property spriteNum, pAngle, pPowerMeter, pMaxPower, pSpace, pSpaceStart, pHookDistance, pHookInWater, theAngle, holdTime, pHookLaunchSpeed, pReelOnce
  2. global gNumFishCaught, gScore, gFishCaught, gSpriteCaught, gFishFollowingBait, gPlayOnce, pLaunchHook
  3.  
  4. on beginSprite me
  5.   gPlayOnce = 1
  6.   pReelOnce = 1
  7.   pHookInWater = 0
  8.   pHookDistance = 0
  9.   pLaunchHook = 0
  10.   pSpace = 0
  11.   pSpaceStart = 0
  12.   pMaxPower = 147
  13.   sprite(25).blend = 100
  14.   sprite(25).loc = point(800, 800)
  15. end
  16.  
  17. on exitFrame
  18.   if sprite(35).locH < 800 then
  19.     sprite(35).width = sprite(35).width + 1
  20.     sprite(35).blend = sprite(35).blend - 5
  21.     if sprite(35).blend < 10 then
  22.       sprite(35).loc = point(900, 900)
  23.       sprite(35).blend = 100
  24.       sprite(35).width = 104
  25.     end if
  26.   end if
  27.   if pHookInWater = 1 then
  28.     sprite(8).locH = sprite(8).locH - 10
  29.     if sprite(8).locH < 404 then
  30.       sprite(8).locH = 404
  31.     end if
  32.     sprite(7).width = sprite(7).width - 10
  33.     if sprite(7).width < 0 then
  34.       sprite(7).width = 0
  35.     end if
  36.   end if
  37.   if (the rightMouseDown = 1) and (pHookInWater = 1) then
  38.     if the frame > 1 then
  39.       exit
  40.     end if
  41.     if pReelOnce = 1 then
  42.       puppetSound(2, "reel_in")
  43.       pReelOnce = 0
  44.     end if
  45.     railInHook()
  46.     sprite(25).rotation = sprite(25).rotation + 10
  47.     if sprite(25).rotation > 120 then
  48.       sprite(25).rotation = 120
  49.     end if
  50.   else
  51.     if soundBusy(2) then
  52.       sound(2).stop()
  53.       pReelOnce = 1
  54.     end if
  55.     if (sprite(25).locV > 0) and (sprite(25).locH > 0) and (sprite(25).locH < 600) then
  56.       if gFishCaught = 1 then
  57.         sprite(25).loc = point(sprite(25).locH - (float(sin(theAngle * 3.14000000000000012 / 180.0)) * 1), sprite(25).locV - (float(cos(theAngle * 3.14000000000000012 / 180.0)) * 1))
  58.       end if
  59.     end if
  60.     sprite(25).rotation = sprite(25).rotation - 5
  61.     if sprite(25).rotation < 0 then
  62.       sprite(25).rotation = 0
  63.     end if
  64.   end if
  65.   if pLaunchHook = 0 then
  66.     if pHookInWater = 1 then
  67.       exit
  68.     end if
  69.     if the frame > 1 then
  70.       exit
  71.     end if
  72.     if mouseV() < 350 then
  73.       pAngle = getAngle(point(sprite(spriteNum).locH, sprite(spriteNum).locV), point(mouseH(), mouseV()))
  74.       sprite(spriteNum).rotation = 360 - pAngle
  75.     end if
  76.     checkInput()
  77.   else
  78.     doHookLaunch()
  79.   end if
  80. end
  81.  
  82. on checkInput
  83.   if the frame > 1 then
  84.     exit
  85.   end if
  86.   if (the mouseDown = 1) and (pSpace = 0) then
  87.     if pHookInWater = 1 then
  88.       exit
  89.     end if
  90.     pSpace = 1
  91.     pSpaceStart = the ticks
  92.   end if
  93.   if the mouseDown = 1 then
  94.     if pHookInWater = 1 then
  95.       exit
  96.     end if
  97.     holdTime = (the ticks - pSpaceStart) / 3
  98.     if holdTime > 15 then
  99.       holdTime = 15
  100.     end if
  101.     sprite(8).locH = (holdTime * 147 / 15) + 404
  102.     sprite(7).width = holdTime * 147 / 15
  103.   end if
  104.   if (the mouseDown = 0) and (pSpace = 1) then
  105.     if pHookInWater = 1 then
  106.       exit
  107.     end if
  108.     theAngle = 360 - sprite(spriteNum).rotation
  109.     sprite(25).loc = point(sprite(spriteNum).locH - (float(sin(theAngle * 3.14000000000000012 / 180.0)) * 60), sprite(spriteNum).locV - (float(cos(theAngle * 3.14000000000000012 / 180.0)) * 60))
  110.     pSpace = 0
  111.     holdTime = (the ticks - pSpaceStart) / 3
  112.     if holdTime > 15 then
  113.       holdTime = 15
  114.     end if
  115.     if holdTime < 4 then
  116.       holdTime = 4
  117.     end if
  118.     pHookDistance = holdTime * 24
  119.     sprite(spriteNum).member = "fisherman2"
  120.     pLaunchHook = 1
  121.     gFishFollowingBait = 0
  122.     sprite(25).blend = 100
  123.     pHookLaunchSpeed = (holdTime / 2) + 3
  124.   end if
  125. end
  126.  
  127. on railInHook
  128.   if gFishCaught = 1 then
  129.     sprite(spriteNum).member = "fisherman3"
  130.     factor = random(4) - 2
  131.   else
  132.     factor = 3
  133.   end if
  134.   sprite(25).loc = point(sprite(25).locH + (float(sin(theAngle * 3.14000000000000012 / 180.0)) * factor), sprite(25).locV + (float(cos(theAngle * 3.14000000000000012 / 180.0)) * factor))
  135.   if sprite(25).locV > 350 then
  136.     gPlayOnce = 1
  137.     if gFishCaught = 1 then
  138.       gNumFishCaught = gNumFishCaught + 1
  139.       gScore = gScore + 10
  140.       member("FishesDisplay").text = string(gNumFishCaught)
  141.       member("ScoreDisplay").text = string(gScore)
  142.       puppetSound(3, "catchfish")
  143.       sprite(spriteNum).member = "hasFish"
  144.       sprite(25).loc = point(800, 800)
  145.       sprite(25).blend = 100
  146.       pLauchHook = 0
  147.       pHookInWater = 0
  148.       sprite(gSpriteCaught).loc = point(800, 800)
  149.       sprite(gSpriteCaught).blend = 0
  150.     else
  151.       sprite(25).loc = point(800, 800)
  152.       pLauchHook = 0
  153.       pHookInWater = 0
  154.       sprite(spriteNum).member = "fisherman1"
  155.     end if
  156.   end if
  157. end
  158.  
  159. on doHookLaunch
  160.   sprite(25).loc = point(sprite(25).locH - (float(sin(theAngle * 3.14000000000000012 / 180.0)) * pHookLaunchSpeed), sprite(25).locV - (float(cos(theAngle * 3.14000000000000012 / 180.0)) * pHookLaunchSpeed))
  161.   pHookDistance = pHookDistance - pHookLaunchSpeed
  162.   pHookInWater = 1
  163.   if gPlayOnce = 1 then
  164.     puppetSound(1, "cast")
  165.     gPlayOnce = 0
  166.   end if
  167.   if pHookDistance <= 0 then
  168.     pHookLaunchSpeed = pHookLaunchSpeed - 0.5
  169.     if pHookLaunchSpeed <= 0 then
  170.       pLaunchHook = 0
  171.       sprite(25).blend = 20
  172.       sprite(35).loc = sprite(25).loc
  173.       puppetSound(5, "watersplash")
  174.     end if
  175.   end if
  176. end
  177.