home *** CD-ROM | disk | FTP | other *** search
- property pStartPosition, pTrampHalf, pCollisionBuffer, pCollBuffer2, pBouncePower, pSplitPoint, pCurrentBoneI, pAmt, originalCamY, pVV, P1, P2, pRV, pBallObjToDelete, pPumpObjToDelete, pFinish, pMode, pFalling, pLastFalling, pControl, pTargetList, pBouncerList, pBLcnt, my, dogmesh, pTrampoline, pTdownModel, pTupModel, pTorigModel, pTrampTimer, pCamera, pTargetTimer, pBatModeTimer, pHelpCounter, pMouseMaxTop, pMouseMaxBottom, pStixMaxTop, pStixMaxBottom, pUDratio, pStixMaxLeft, pStixMaxRight, pMouseMaxLeft, pMouseMaxRight, pLRratio, pMaxH, pMinH, pMaxV, pMinV, pAnimSpeed, pMidPoint, pEndPoint
- global gWorld, game, gLevel
-
- on new me, paramList
- pMode = #launch
- pAnimSpeed = 1.0
- tTotalFrames = 60.0
- tMid = tTotalFrames / 2.0
- pMidPoint = tMid * 33.0
- pEndPoint = tTotalFrames * 33.0
- pCamera = paramList.cam
- originalCamY = pCamera.worldPosition.y
- t = vector(0, 0, 0)
- pVV = t
- P1 = t
- P2 = t
- pTrampHalf = 60
- pCollisionBuffer = 20
- pCollBuffer2 = pCollisionBuffer + 7
- pBouncePower = 20
- pSplitPoint = 30
- pCurrentBoneI = 1
- pAmt = 1
- pRV = 0
- pHelpCounter = 0
- pTrampoline = gWorld.model("trampoline")
- pTrampoline.addChild(gWorld.model("trampoline_frame1"))
- pTrampoline.addChild(gWorld.model("trampoline_frame2"))
- pTrampoline.addChild(gWorld.model("trampoline_frame3"))
- pTrampoline.addChild(gWorld.model("tramp_frame"))
- pTdownModel = pTrampoline.child[1]
- pTdownModel.translate(0, 0, 10000)
- pTupModel = pTrampoline.child[2]
- pTupModel.translate(0, 0, 10000)
- pTorigModel = pTrampoline.child[3]
- pTrampoline.translate(20, 0, 0)
- my = paramList.player
- my.translate(0, 0, 4)
- paramList.dog.worldPosition = my.worldPosition
- paramList.dog.transform.scale = vector(2.5, 2.5, 2.5)
- my.addChild(paramList.dog)
- dogmesh = my.child[1]
- my.child[1].bonesPlayer.playRate = pAnimSpeed
- my.child[1].bonesPlayer.pause()
- my.child[1].bonesPlayer.currentTime = 0
- gWorld.model("dog_shadow").transform.position.y = -262.91190000000000282
- gWorld.model("tramp_shadow").transform.position.y = -282.82139999999998281
- gWorld.model("tramp_shadow").worldPosition.x = pTrampoline.worldPosition.x + 10
- gWorld.shader("shadow_shader").blend = 60
- gWorld.model("lingo_borderR").shader.blend = 0
- pMaxH = integer(gWorld.model("lingo_borderR").worldPosition.x)
- pMinH = integer(gWorld.model("lingo_borderL").worldPosition.x)
- pMinV = 13
- pMaxV = integer(gWorld.model("lingo_borderT").worldPosition.z)
- my.worldPosition.x = pMinH
- me.setupMouseControl()
- pTargetList = []
- repeat with x = 1 to gWorld.model.count
- if gWorld.model[x].name contains "bone" then
- pTargetList.add(gWorld.model[x])
- end if
- end repeat
- pBouncerList = []
- repeat with x = 1 to gWorld.model.count
- if gWorld.model[x].name contains "bounce" then
- pBouncerList.add(gWorld.model[x])
- end if
- end repeat
- pBLcnt = pBouncerList.count
- return me
- end
-
- on stepit me
- tOrigT = pCamera.transform.duplicate()
- tC = pCamera
- tCpos = tC.worldPosition
- tTpos = pTrampoline.worldPosition
- tMyPos = my.worldPosition
- tDiff = tMyPos - tTpos
- tDiffM = tDiff.magnitude * 0.5
- tPointPoint = tMyPos - (tDiff * 0.40000000000000002)
- if tPointPoint.z < 100 then
- tPointPoint.z = 100
- end if
- tC.pointAt(tPointPoint, vector(0, 0, 1))
- tFinal = originalCamY - tDiffM
- ccY = tCpos.y
- tPO = (tFinal - ccY) * 0.20000000000000001
- if tMyPos.z > pSplitPoint then
- pT = tMyPos
- if pVV.z < 0 then
- ttz = tPointPoint.z
- else
- ttz = tMyPos.z + 40
- end if
- pT = vector(tMyPos.x, 0, ttz)
- else
- ttz = tMyPos.z + 40
- pT = vector(tTpos.x, 0, ttz)
- end if
- tP = 0.20000000000000001
- TH = (pT.x - tCpos.x) * tP
- tZ = (pT.z - tCpos.z) * 0.05
- tC.translate(TH, tPO, tZ, #world)
- tFinalT = tC.transform.duplicate()
- tOrigT.interpolateTo(tFinalT, 20)
- pCamera.transform.rotation = tOrigT.rotation
- gWorld.model("dog_shadow").worldPosition.x = tMyPos.x
- P1 = tMyPos
- if pMode = #fly then
- if pControl = #keyboard then
- if keyPressed(123) then
- pTrampoline.translate(-10, 0, 0)
- else
- if keyPressed(124) then
- pTrampoline.translate(10, 0, 0)
- end if
- end if
- tPos = pTrampoline.worldPosition
- else
- tMouseH = the mouseH
- pStixH = (pLRratio * (tMouseH - pMouseMaxLeft)) + pStixMaxLeft
- tP = 0.10000000000000001
- pTrampoline.translate((pStixH - pTrampoline.worldPosition.x) * tP, 0, 0)
- tPos = pTrampoline.worldPosition
- end if
- tBuffer = 20
- if tPos.x < (pStixMaxLeft - tBuffer) then
- pTrampoline.worldPosition.x = pStixMaxLeft - tBuffer
- tPos.x = pStixMaxLeft
- else
- if tPos.x > (pStixMaxRight + tBuffer) then
- pTrampoline.worldPosition.x = pStixMaxRight + tBuffer
- tPos.x = pStixMaxRight
- end if
- end if
- gWorld.model("tramp_shadow").worldPosition.x = tPos.x + 10
- pGravity = vector(0, 0, -0.5)
- pVV = pVV * 0.97999999999999998
- if pVV.z < -3 then
- pLastFalling = 1
- else
- pLastFalling = 0
- end if
- tMove = pGravity + pVV
- if tMove.magnitude > 75 then
- tMove = tMove.getNormalized() * 75
- end if
- my.translate(tMove, #world)
- tX = my.worldPosition.x
- if tX < pMinH then
- my.worldPosition.x = pMinH
- my.translate(abs(pVV.x), 0, 0)
- else
- if tX > pMaxH then
- my.worldPosition.x = pMaxH
- my.translate(-abs(pVV.x), 0, 0)
- end if
- end if
- if my.worldPosition.z < pMinV then
- my.worldPosition.z = pMinV
- tDiff = pTrampoline.worldPosition.x - tX
- put "tDiff" && tDiff
- tDA = abs(tDiff)
- if tDA < pTrampHalf then
- my.translate(-tDiff, 0, 40)
- sound(3).volume = 200
- puppetSound(3, "bounce_pop")
- me.makeSound()
- my.child[1].bonesPlayer.play("dog", 0, 0, pMidPoint, pAnimSpeed)
- pRV = tDiff
- if tDA < ((pTrampHalf / 2) + 10) then
- me.animT(#down)
- pTrampTimer = 10
- end if
- else
- me.killDog()
- end if
- else
- if my.worldPosition.z > pMaxV then
- my.worldPosition.z = pMaxV
- end if
- end if
- dogmesh.rotate(0, pRV, 0)
- pRV = pRV * 0.97999999999999998
- P2 = my.worldPosition
- pVV = P2 - P1
- if (pVV.z < -3) and (pLastFalling = 0) then
- sound(4).volume = 75
- puppetSound(4, "fall_whistle")
- my.child[1].bonesPlayer.play("dog", 0, pMidPoint, pEndPoint, pAnimSpeed)
- end if
- if pTrampTimer > 0 then
- pTrampTimer = pTrampTimer - 1
- if pTrampTimer = 6 then
- me.animT(#normal)
- else
- if pTrampTimer = 5 then
- me.animT(#up)
- else
- if pTrampTimer = 2 then
- me.animT(#normal)
- end if
- end if
- end if
- end if
- else
- if pMode = #launch then
- pHelpCounter = pHelpCounter + 1
- if pHelpCounter > 30 then
- game.HUD.showInstruction(#on)
- end if
- if the mouseDown or keyPressed(" ") then
- my.translate(6, 0, 30)
- pMode = #fly
- sound(3).volume = 255
- puppetSound(3, "bounce_pop")
- my.child[1].bonesPlayer.play("dog", 0, 0, pMidPoint, pAnimSpeed)
- me.makeSound()
- if pHelpCounter > 30 then
- game.HUD.showInstruction(#off)
- end if
- if keyPressed(" ") then
- pControl = #keyboard
- end if
- end if
- P2 = my.worldPosition
- pVV = P2 - P1
- pRV = 4
- else
- if pMode = #crash then
- pFinish = pFinish + 1
- if pFinish = 60 then
- puppetSound(2, 0)
- puppetSound(3, 0)
- puppetSound(4, 0)
- game.stop()
- member("score_final_text").text = member("score_text").text
- go("finish")
- cursor(0)
- end if
- else
- if pMode = #finish then
- pFinish = pFinish + 1
- my.child[1].rotate(0, 6, 0)
- if pFinish = 2 then
- sound(1).volume = 255
- puppetSound(1, "clap")
- else
- if pFinish = 120 then
- game.stop()
- member("score_final_text").text = member("score_text").text
- gLevel = gLevel + 1
- gLevel = min(gLevel, 5)
- go("win")
- cursor(0)
- end if
- end if
- if pFinish = 30 then
- sound(2).volume = 220
- puppetSound(2, "dog4")
- else
- if pFinish = 40 then
- puppetSound(2, "dog4")
- else
- if pFinish = 70 then
- puppetSound(2, "dog4")
- end if
- end if
- end if
- if pFinish = 23 then
- game.HUD.popFirework()
- else
- if pFinish = 34 then
- game.HUD.popFirework()
- else
- if pFinish = 43 then
- game.HUD.popFirework()
- else
- if pFinish = 64 then
- game.HUD.popFirework()
- else
- if pFinish = 80 then
- game.HUD.popFirework()
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- tMyx = my.worldPosition.x
- tMyz = my.worldPosition.z
- pBoneMaxI = pTargetList.count
- if pBoneMaxI > 0 then
- pCurrentBoneI = pCurrentBoneI + 1
- if pCurrentBoneI > pBoneMaxI then
- pCurrentBoneI = 1
- end if
- pTargetList[pCurrentBoneI].rotate(0, 5, 0)
- repeat with x = 1 to pBoneMaxI
- tm = pTargetList[x]
- tm.rotate(0, 5, 0)
- if abs(tMyx - tm.worldPosition.x) < pCollisionBuffer then
- if abs(tMyz - tm.worldPosition.z) < pCollisionBuffer then
- me.collectBone()
- pTargetList.deleteOne(tm)
- tm.removeFromWorld()
- exit repeat
- end if
- end if
- end repeat
- if gLevel < 4 then
- repeat with x = 1 to pBLcnt
- tm = pBouncerList[x]
- tm.rotate(3, -5, -0.5)
- if abs(tMyx - tm.worldPosition.x) < pCollBuffer2 then
- if abs(tMyz - tm.worldPosition.z) < pCollBuffer2 then
- tVec = vector(tMyx - tm.worldPosition.x, 0, tMyz - tm.worldPosition.z)
- tVec = tVec.getNormalized() * 10
- put tVec
- my.translate(tVec)
- sound(4).volume = 255
- puppetSound(4, "bumper")
- P2 = my.worldPosition
- pVV = P2 - P1
- pRV = pRV + 1
- exit repeat
- end if
- end if
- end repeat
- else
- if pAmt < 10 then
- pAmt = pAmt + 0.5
- else
- pAmt = -pAmt
- end if
- repeat with x = 1 to pBLcnt
- tm = pBouncerList[x]
- tm.rotate(0, 0, 5)
- tm.translate(pAmt, 0, 0)
- if abs(tMyx - tm.worldPosition.x) < pCollBuffer2 then
- if abs(tMyz - tm.worldPosition.z) < pCollBuffer2 then
- tVec = vector(tMyx - tm.worldPosition.x, 0, tMyz - tm.worldPosition.z)
- tVec = tVec.getNormalized() * 10
- put tVec
- my.translate(tVec)
- P2 = my.worldPosition
- pVV = P2 - P1
- pRV = pRV + 1
- exit repeat
- end if
- end if
- end repeat
- end if
- else
- pMode = #finish
- end if
- if keyPressed("s") then
- if the runMode contains "author" then
- pMode = #finish
- end if
- end if
- end
-
- on animT me, whichway
- tUp = 0
- case whichway of
- #up:
- pTdownModel.transform.position = vector(0, 0, 10000)
- pTupModel.transform.position = vector(0, 0, tUp)
- pTorigModel.transform.position = vector(0, 0, 10000)
- #down:
- pTdownModel.transform.position = vector(0, 0, tUp)
- pTupModel.transform.position = vector(0, 0, 10000)
- pTorigModel.transform.position = vector(0, 0, 10000)
- #normal:
- pTdownModel.transform.position = vector(0, 0, 10000)
- pTupModel.transform.position = vector(0, 0, 10000)
- pTorigModel.transform.position = vector(0, 0, tUp)
- end case
- end
-
- on makeSound me
- tn = random(6)
- tS = "dog" & tn
- sound(2).volume = random(200) + 55
- puppetSound(2, tS)
- end
-
- on killDog me
- if pMode = #fly then
- puppetSound(3, 0)
- sound(4).volume = 255
- puppetSound(4, "dog6")
- end if
- pMode = #crash
- pVV = vector(0, 0, 0)
- pRV = 0
- dogmesh.transform.rotation = vector(0, 0, 0)
- my.child[1].bonesPlayer.pause()
- my.child[1].bonesPlayer.currentTime = 0
- my.worldPosition.z = 15
- end
-
- on collectBone me
- sound(3).volume = random(20) + 50
- puppetSound(3, "witchlaugh")
- game.HUD.showscore(my.worldPosition, 500)
- tn = random(6)
- tS = "dog" & tn
- sound(2).volume = random(200) + 55
- puppetSound(2, tS)
- end
-
- on setupMouseControl me
- pStixMaxLeft = pMinH + pTrampHalf
- pStixMaxRight = pMaxH - pTrampHalf
- pMouseMaxLeft = 0.0
- pMouseMaxRight = 380.0
- x2 = pMouseMaxRight
- x1 = pMouseMaxLeft
- y2 = pStixMaxRight
- y1 = pStixMaxLeft
- pLRratio = (y1 - y2) / (x1 - x2)
- end
-