home *** CD-ROM | disk | FTP | other *** search
- global gFlshSpt, gStpLght, gCarSpt, gStBar, gFstLne, gLstLne, gFstObs, gLstObs, gSpdFactor, gLangSelect, gLangDirect, gRoadCollision, gRaceArch, gRacing, gFstRaceTime, gFstRaceScore, gNxtTime, gFlashTimer, gRaceTimer, gOnScnLst, gOffScnLst, gFloatDir, gScore, gCarBox
-
- on goToRaceCut
- go("preRace")
- unloadMember(member "fart1", "click13")
- unloadMember()
- startTheTimer(gRaceTimer)
- end
-
- on giveRaceInstructions
- cursor(4)
- go("race")
- doMusicBtn()
- doScore()
- unloadMember(member "bridgecutscene")
- preloadMember(member "roadcollision", "ocean 21")
- set gRacing to 0
- set gNxtTime to 0
- popUp("arrow", "ok")
- cursor(-1)
- end
-
- on prepRAce
- global gRacing, gFlashTimer, gRaceTimer, gOnScnLst, gOffScnLst, gLstObst, gFloatDir, gBackBtn
- set gRacing to 1
- setclock()
- set the memberNum of sprite gBackBtn to the number of member "back up"
- setUpSpriteLsts()
- set gSpdFactor to 10
- set gFloatDir to 0
- set gLstObst to VOID
- startTheTimer(gRaceTimer)
- puppetSound(2, "light1")
- puppetSound(1, "car 0")
- end
-
- on setUpSpriteLsts
- global gOnScnLst, gOffScnLst, gLstLne, gLstONLne, gObstLst, gFstObs
- set gOnScnLst to []
- set gOffScnLst to []
- set gObstLst to []
- repeat with X = gStBar to gLstObs
- add(gOffScnLst, X)
- if (X >= gFstObs) and (X <= gLstObs) then
- add(gObstLst, X)
- end if
- end repeat
- add(gOffScnLst, gRaceArch)
- add(gOnScnLst, gStBar)
- deleteAt(gOffScnLst, getPos(gOffScnLst, gStBar))
- add(gOnScnLst, gRaceArch)
- deleteAt(gOffScnLst, getPos(gOffScnLst, gRaceArch))
- set lastLn to gFstLne + 5
- repeat with X = gFstLne to lastLn
- add(gOnScnLst, X)
- deleteAt(gOffScnLst, getPos(gOffScnLst, X))
- end repeat
- set gLstONLne to lastLn
- end
-
- on endRace
- global gRacing, gFlashTimer, gRaceTimer
- set gRacing to VOID
- stopFlash()
- stopTimer(gFlashTimer)
- stopTimer(gRaceTimer)
- end
-
- on goToPhaseTwo
- global gRacing, gStpLght, gRaceTimer
- set the memberNum of sprite gStpLght to the number of member "2 light"
- set gRacing to 2
- startTheTimer(gRaceTimer)
- puppetSound(2, "light2")
- end
-
- on goToPhaseThree
- global gRacing, gStpLght, gRaceTimer, gMusOn
- set the memberNum of sprite gStpLght to the number of member "3 light"
- stopFlash()
- set gRacing to 3
- if gMusOn = 1 then
- sound stop 3
- puppetSound(3, "drive")
- end if
- startTheTimer(gRaceTimer)
- puppetSound(2, "light3")
- end
-
- on goToPhaseFour
- global gRacing, gStpLght, gRaceTimer, gRoad, gStBar, gCarSpt, gMusOn
- set the memberNum of sprite gStpLght to the number of member "1 light"
- set the memberNum of sprite gCarSpt to the number of member "1 car"
- set gRacing to 4
- puppetSound(2, "light4")
- puppetSound(1, "cheer")
- if gMusOn = 1 then
- sound stop 3
- puppetSound(3, "loop")
- end if
- set gSpdFactor to 8
- if gLangDirect = 1 then
- set whichLang to "e"
- else
- set whichLang to gLangSelect
- end if
- set the memberNum of sprite gFlshSpt to the number of member ("1 " & whichLang & " bravoFlsh")
- set the memberNum of sprite gStBar to the number of member "checker"
- set the memberNum of sprite gRaceArch to the number of member "archend" of castLib "race"
- set the locV of sprite gRaceArch to the top of sprite gRoad - (the height of sprite gRaceArch / 2)
- set the locV of sprite gStBar to the top of sprite gRoad
- startTheTimer(gFlashTimer)
- updateStage()
- end
-
- on goToPhaseFive
- global gRacing, gRaceTimer, gBackBtn
- set gRacing to 5
- set the memberNum of sprite gBackBtn to the number of member "back flash up"
- startTheTimer(gRaceTimer)
- end
-
- on doSpeed whichWay
- global gSpdFactor
- case whichWay of
- "1":
- set gSpdFactor to max(0, gSpdFactor - 2)
- "2":
- set gSpdFactor to min(65, gSpdFactor + 2)
- end case
- doCarSnd()
- end
-
- on doCarSnd
- global gCarSnd
- if gSpdFactor > 0 then
- set whichCar to string(gSpdFactor)
- if the number of chars in whichCar = 1 then
- set whichCar to "car 0"
- else
- set whichCar to "car " & char 1 of whichCar
- end if
- else
- set whichCar to "car 0"
- end if
- if gCarSnd <> whichCar then
- puppetSound(1, whichCar)
- set gCarSnd to whichCar
- end if
- end
-
- on moveCar whichDir
- global gCarSpt, gRoad, gFloatDir, gRacing
- if (gRacing = 3) or (gRacing = 8) or (gRacing = 9) then
- case gRacing of
- 3:
- set moveSpd to 7
- 8:
- set moveSpd to 3
- 9:
- set moveSpd to 3
- end case
- set lMax to integer(the left of sprite gRoadCollision + (the width of sprite gCarSpt / 2))
- set rMax to integer(the right of sprite gRoadCollision - (the width of sprite gCarSpt / 2))
- case whichDir of
- "1":
- set the locH of sprite gCarSpt to min(the locH of sprite gCarSpt + moveSpd, rMax)
- set gFloatDir to 1
- "2":
- set the locH of sprite gCarSpt to max(the locH of sprite gCarSpt - moveSpd, lMax)
- set gFloatDir to -1
- end case
- set the loc of sprite gCarBox to the loc of sprite gCarSpt
- end if
- end
-
- on raceObstacles
- global gRacing, gRoad, gLstLne, gLstONLne, gSpdFactor, gLstObst, gObstLst, gStBar, gFloatDir, gRaceTimer
- repeat with X = 1 to count(gOnScnLst)
- set aSprite to getAt(gOnScnLst, X)
- set the locV of sprite aSprite to the locV of sprite aSprite + gSpdFactor
- if the top of sprite aSprite > (the bottom of sprite gRoad + 140) then
- moveOffScreen(aSprite)
- end if
- if aSprite = gLstONLne then
- set newLnLmt to (the height of sprite aSprite / 2) + 140
- if the locV of sprite aSprite >= newLnLmt then
- addNewLine()
- end if
- end if
- end repeat
- if (gRacing = 3) or (gRacing = 8) then
- if gFloatDir = 1 then
- set the locH of sprite gCarSpt to min(the locH of sprite gCarSpt + gFloatDir, the right of sprite gRoadCollision - (the width of sprite gCarSpt / 2))
- else
- set the locH of sprite gCarSpt to max(the locH of sprite gCarSpt + gFloatDir, the left of sprite gRoadCollision + (the width of sprite gCarSpt / 2))
- end if
- set the loc of sprite gCarBox to the loc of sprite gCarSpt
- set obstLim to the height of sprite gFstObs + the height of sprite gCarSpt
- if gSpdFactor < 10 then
- set obFreq to 10
- else
- if (gSpdFactor >= 10) and (gSpdFactor < 50) then
- set obFreq to 10
- else
- if (gSpdFactor >= 50) and (gSpdFactor < 70) then
- set obFreq to 10
- end if
- end if
- end if
- set shouldI to random(obFreq)
- if gLstObst = VOID then
- set goAhead to 1
- else
- if (the top of sprite gLstObst >= obstLim) or (getPos(gOffScnLst, gLstObst) <> 0) then
- set goAhead to 1
- end if
- end if
- if (shouldI = 1) and (goAhead = 1) and (gObstLst <> []) then
- addObstacle()
- end if
- if gRacing <> 8 then
- repeat with X = 1 to count(gOnScnLst)
- set aObst to getAt(gOnScnLst, X)
- if sprite gCarBox intersects aObst and (aObst <= gLstObs) and (aObst >= gFstObs) then
- if the name of member the memberNum of sprite aObst of castLib "race" = "RAMP" then
- startRampHappiness()
- exit repeat
- next repeat
- end if
- doCollision()
- exit repeat
- end if
- end repeat
- end if
- else
- if gRacing = 4 then
- set gSpdFactor to 8
- set the locV of sprite gStBar to the locV of sprite gStBar + gSpdFactor
- if the locV of sprite gStBar >= (the top of sprite gCarSpt - the height of sprite gRaceArch) then
- set the locV of sprite gRaceArch to min(the top of sprite gRoad + (the height of sprite gRaceArch / 2), the locV of sprite gRaceArch + gSpdFactor)
- end if
- if sprite gCarSpt intersects gStBar then
- goToPhaseFive()
- end if
- end if
- end if
- end
-
- on addObstacle
- global gLstObst, gRoad, gCarSpt
- set currObst to getAt(gObstLst, 1)
- deleteAt(gObstLst, 1)
- add(gOnScnLst, currObst)
- deleteAt(gOffScnLst, getPos(gOffScnLst, currObst))
- set gLstObst to currObst
- if random(7) = 1 then
- set the memberNum of sprite currObst to the number of member "RAMP"
- else
- set whichob to random(6)
- set the memberNum of sprite currObst to the number of member (whichob & " obstacle")
- end if
- set the locV of sprite currObst to the top of sprite gRoad
- if random(5) = 1 then
- set whereH to the locH of sprite gCarSpt
- else
- set lMax to integer(the left of sprite gRoadCollision + (the width of sprite gCarSpt / 2))
- set rMax to integer(the right of sprite gRoadCollision - (the width of sprite gCarSpt / 2))
- set whereH to random(abs(lMax - rMax)) + (lMax - 1)
- end if
- set the locH of sprite currObst to whereH
- end
-
- on moveOffScreen whichSprite
- global gOnScnLst, gOffScnLst, gLstLne, gScore, gRacing
- add(gOffScnLst, whichSprite)
- deleteAt(gOnScnLst, getPos(gOnScnLst, whichSprite))
- set the locV of sprite whichSprite to -100
- if (gRacing = 3) or (gRacing = 8) then
- if (whichSprite <= gLstLne) and (whichSprite >= gFstLne) then
- set gScore to gScore + 2
- else
- if (whichSprite <= gLstObs) and (whichSprite >= gFstObs) then
- set gScore to gScore + 10
- add(gObstLst, whichSprite)
- end if
- end if
- doScore()
- end if
- end
-
- on addNewLine
- global gOnScnLst, gOffScnLst, gRoad, gLstLne, gLstONLne
- repeat with z = 1 to count(gOffScnLst)
- set aSprite to getAt(gOffScnLst, z)
- if (aSprite <= gLstLne) and (aSprite >= gFstLne) then
- add(gOnScnLst, aSprite)
- deleteAt(gOffScnLst, getPos(gOffScnLst, aSprite))
- set the locV of sprite aSprite to the top of sprite gRoad
- set gLstONLne to aSprite
- exit repeat
- end if
- end repeat
- end
-
- on startRampHappiness
- global gRacing, gFlashTimer, gScore, gSpdFactor, gRampTime
- set gRacing to 8
- set gRampTime to gSpdFactor
- startTheTimer(gFlashTimer)
- set gScore to gScore + 50
- puppetSound(2, "rampSnd")
- end
-
- on pursueRampHappiness
- global gCarSpt
- set foo to value(word 1 of the name of member the memberNum of sprite gCarSpt of castLib "race")
- if foo <> 4 then
- set foo to string(foo + 1)
- set the memberNum of sprite gCarSpt to the number of member (foo & " car")
- end if
- end
-
- on stopRampHappiness
- global gRacing, gFlashTimer
- repeat with X = 4 down to 1
- set the memberNum of sprite gCarSpt to the number of member (X & " car")
- updateStage()
- end repeat
- set gRacing to 3
- stopTimer(gFlashTimer)
- puppetSound(2, "rampdn")
- end
-
- on doCollision
- global gScore, gFlashTimer, gStpLght, gRacing, gSpdFactor
- set gScore to max(0, gScore - 10)
- doScore()
- set gSpdFactor to -10
- doCarSnd()
- set gRacing to 9
- set the memberNum of sprite gStpLght to the number of member "2 light"
- startTheTimer(gFlashTimer)
- set whichBmp to random(3)
- puppetSound(2, "bump" & whichBmp)
- end
-
- on stopCollisionPunishment
- global gRaceTimer, gStpLght, gRacing, gSpdFactor
- set gRacing to 3
- set gSpdFactor to 10
- doCarSnd()
- set the memberNum of sprite gStpLght to the number of member "3 light"
- end
-
- on flashRaceSign
- global gFlshSpt
- set foo to the name of member the memberNum of sprite gFlshSpt of castLib "race"
- set whichFlsh to word 1 of foo
- if whichFlsh = "1" then
- set whichFlsh to "2"
- else
- set whichFlsh to "1"
- end if
- put whichFlsh into word 1 of foo
- set the memberNum of sprite gFlshSpt to the number of member foo
- startTheTimer(gFlashTimer)
- end
-
- on stopFlash
- global gFlshSpt
- stopTimer(gFlashTimer)
- set foo to the name of member the memberNum of sprite gFlshSpt of castLib "race"
- set whichFlsh to word 1 of foo
- set whichFlsh to "2"
- put whichFlsh into word 1 of foo
- set the memberNum of sprite gFlshSpt to the number of member foo
- end
-
- on setclock
- global gSec, gMin, gRaceLength
- set gRaceLength to 45
- set gSec to gRaceLength
- set gMin to 0
- if the number of chars in string(gSec) = 1 then
- set cosSec to "0" & gSec
- else
- set cosSec to gSec
- end if
- if the number of chars in string(gMin) = 1 then
- set cosMin to "0" & gMin
- else
- set cosMin to gMin
- end if
- set timetext to cosMin & ":" & cosSec
- set aSpt to gFstRaceTime
- repeat with X = 1 to the number of chars in timetext
- set aChar to char X of timetext
- set the memberNum of sprite aSpt to the number of member ("time " & aChar)
- set aSpt to aSpt + 1
- end repeat
- end
-
- on rollDownClock
- global gSec, gMin, gNxtTime
- set gNxtTime to gNxtTime + 60
- set gSec to gSec - 1
- if gSec < 0 then
- set gMin to max(0, gMin - 1)
- set gSec to 59
- end if
- if the number of chars in string(gSec) = 1 then
- set cosSec to "0" & gSec
- else
- set cosSec to gSec
- end if
- if the number of chars in string(gMin) = 1 then
- set cosMin to "0" & gMin
- else
- set cosMin to gMin
- end if
- set timetext to cosMin & ":" & cosSec
- set aSpt to gFstRaceTime
- repeat with X = 1 to the number of chars in timetext
- set aChar to char X of timetext
- set the memberNum of sprite aSpt to the number of member ("time " & aChar)
- set aSpt to aSpt + 1
- end repeat
- end
-
- on doScore
- put gScore into field "gScore"
- set scoreText to string(gScore)
- set aSpt to gFstRaceScore + 6
- repeat with X = the number of chars in scoreText down to 1
- set aChar to char X of scoreText
- set the memberNum of sprite aSpt to the number of member ("score " & aChar)
- set aSpt to aSpt - 1
- end repeat
- end
-