home *** CD-ROM | disk | FTP | other *** search
Wrap
property pPattern, pOriginalPoint, pCurrentPoint, pFishSize, pBaitAttraction, pDestPoint, pNumPoints, pAngle, spriteNum, pAverageSpeed, pSpeed, pRestTime, pRestCount, pRestTicks, pCaught, pState, pStruggleLeft, pDifference, pFrame, pFishName, pFrameTimer, pFishDead global pLaunchHook, gPattern, gFishCaught, gSpriteCaught, gFishFollowingBait on beginSprite me gFishFollowingBait = 0 gFishCaught = 0 pFrameTimer = the ticks pFrame = 1 pDifference = 0 pStruggleLeft = 1 pCaught = 0 pRestTime = 0 pRestCount = 0 pPattern = duplicate(gPattern) pAverageSpeed = 2 pSpeed = pAverageSpeed pNumPoints = count(gPattern) pDestPoint = random(pNumPoints) pOriginalPoint = point(sprite(spriteNum).locH, sprite(spriteNum).locV) pCurrentPoint = point(pOriginalPoint[1], pOriginalPoint[2]) relocatePattern() pAngle = getAngle(pCurrentPoint, pPattern[pDestPoint]) sprite(spriteNum).rotation = 360 - pAngle pRestTicks = the ticks if random(4) = 1 then pRestTime = random(10) + 5 pRestCount = 0 end if pState = 1 end on reinitFish me sprite(spriteNum).member = "fish_2" sprite(spriteNum).loc = pOriginalPoint pCurrentPoint = pOriginalPoint sprite(spriteNum).blend = 40 updateStage() gFishFollowingBait = 0 gFishCaught = 0 pDifference = 0 pStruggleLeft = 1 pCaught = 0 pRestTime = 0 pRestCount = 0 pPattern = duplicate(gPattern) pAverageSpeed = 2 pSpeed = pAverageSpeed pNumPoints = count(gPattern) pDestPoint = random(pNumPoints) relocatePattern() pAngle = getAngle(pCurrentPoint, pPattern[pDestPoint]) sprite(spriteNum).rotation = 360 - pAngle if random(4) = 1 then pRestTime = random(10) + 5 pRestCount = 0 end if pState = 1 end on exitFrame me if the frame > 2 then exit end if if pFishDead = 1 then sprite(spriteNum).loc = point(800, 800) sprite(spriteNum).member = "fish_2" exit end if if sprite(spriteNum).blend = 0 then gFishCaught = 0 pCaught = 0 pFishDead = 1 end if case pState of 1: goAboutNormalBusiness() 2: followBait() 3: eatBait() 4: goBackToOrinalPos() end case end on followBait me if pLaunchHook = 1 then exit end if if getDistance(pCurrentPoint, point(sprite(25).locH, sprite(25).locV)) < 50 then pSpeed = pSpeed - 0.29999999999999999 if pSpeed < 0 then pSpeed = 0 end if else if (pFrameTimer + 5) < the ticks then pFrameTimer = the ticks pFrame = pFrame + 1 if pFrame > 4 then pFrame = 1 end if sprite(spriteNum).member = "fish_" & string(pFrame) end if if pSpeed < pAverageSpeed then pSpeed = pSpeed + 0.29999999999999999 end if pAngle = getAngle(pCurrentPoint, point(sprite(25).locH, sprite(25).locV)) sprite(spriteNum).rotation = 360 - pAngle end if pCurrentPoint[1] = pCurrentPoint[1] - (float(sin(pAngle * 3.14000000000000012 / 180.0)) * pSpeed) pCurrentPoint[2] = pCurrentPoint[2] - (float(cos(pAngle * 3.14000000000000012 / 180.0)) * pSpeed) sprite(spriteNum).loc = pCurrentPoint if (getDistance(pCurrentPoint, point(sprite(25).locH, sprite(25).locV)) > 100) or (sprite(25).blend = 0) then if pCaught = 0 then gFishFollowingBait = gFishFollowingBait - 1 if gFishFollowingBait < 0 then gFishFollowingBait = 0 end if pState = 1 pAngle = getAngle(pCurrentPoint, pPattern[pDestPoint]) sprite(spriteNum).rotation = 360 - pAngle end if end if if (getDistance(pCurrentPoint, pOriginalPoint) > 200) and (sprite(25).blend > 0) and (pLaunchHook = 0) then sprite(spriteNum).member = "FishCaught1" gFishCaught = 1 gSpriteCaught = spriteNum pAngle = getAngle(pCurrentPoint, point(sprite(60).locH, sprite(60).locV)) pCaught = 1 pState = 3 pCurrentPoint = point(sprite(25).locH, sprite(25).locV) sprite(25).blend = 0 end if end on eatBait me sprite(spriteNum).loc = sprite(25).loc if (pFrameTimer + 5) < the ticks then pFrameTimer = the ticks pFrame = pFrame + 1 if pFrame > 4 then pFrame = 1 end if sprite(spriteNum).member = "FishCaught" & string(pFrame) end if if pStruggleLeft = 1 then pAngle = pAngle - 10 if pAngle < 0 then pAngle = 359 end if pDifference = pDifference + 10 if pDifference > (random(20) + 20) then pStruggleLeft = 0 pDifference = 0 end if else pAngle = pAngle + 10 if pAngle > 360 then pAngle = 0 end if pDifference = pDifference + 10 if pDifference > (random(20) + 20) then pStruggleLeft = 1 pDifference = 0 end if end if sprite(spriteNum).rotation = 360 - pAngle end on goBackToOrinalPos me end on goAboutNormalBusiness me if getDistance(pCurrentPoint, point(sprite(25).locH, sprite(25).locV)) < 60 then if gFishFollowingBait <= 1 then if sprite(25).blend > 0 then gFishFollowingBait = gFishFollowingBait + 1 pState = 2 exit end if end if end if if pRestTime > 0 then pSpeed = pSpeed - 0.10000000000000001 if pSpeed < 0 then pSpeed = 0 end if if (pRestTicks + 60) < the ticks then pRestTicks = the ticks pRestCount = pRestCount + 1 end if if pRestCount >= pRestTime then pRestTime = 0 pRestCount = 0 end if else if (pFrameTimer + 5) < the ticks then pFrameTimer = the ticks pFrame = pFrame + 1 if pFrame > 4 then pFrame = 1 end if sprite(spriteNum).member = "fish_" & string(pFrame) end if pSpeed = pSpeed + 0.29999999999999999 if pSpeed > pAverageSpeed then pSpeed = pAverageSpeed end if end if pCurrentPoint[1] = pCurrentPoint[1] - (float(sin(pAngle * 3.14000000000000012 / 180.0)) * pSpeed) pCurrentPoint[2] = pCurrentPoint[2] - (float(cos(pAngle * 3.14000000000000012 / 180.0)) * pSpeed) if (pCurrentPoint[1] > (pPattern[pDestPoint][1] - 7)) and (pCurrentPoint[1] < (pPattern[pDestPoint][1] + 7)) and (pCurrentPoint[2] > (pPattern[pDestPoint][2] - 7)) and (pCurrentPoint[2] < (pPattern[pDestPoint][2] + 7)) then if random(4) = 1 then pFrame = 2 sprite(spriteNum).member = "fish_" & string(pFrame) pRestTime = random(10) + 5 pRestCount = 0 end if pDestPoint = pDestPoint + 1 if pDestPoint > pNumPoints then pDestPoint = 1 end if pAngle = getAngle(pCurrentPoint, pPattern[pDestPoint]) sprite(spriteNum).rotation = 360 - pAngle end if sprite(spriteNum).loc = pCurrentPoint end on relocatePattern me repeat with counter = 1 to count(pPattern) pPattern[counter][1] = pPattern[counter][1] + pOriginalPoint[1] - 92 pPattern[counter][2] = pPattern[counter][2] + pOriginalPoint[2] - 74 end repeat end