home *** CD-ROM | disk | FTP | other *** search
- on initGame
- global bottlesNum, bottlesStrtSprt, bottleNotes, index, seqMaxLength, errors, music
- set the randomSeed to the ticks
- set bottlesNum to 8
- set bottlesStrtSprt to 10
- set tmp to "so: ,la: ,si: ,do: ,re: ,mi: ,fa: ,s2: "
- set bottles to [1, 2, 3, 4, 5, 6, 7, 8]
- repeat with index = 1 to bottlesNum
- set pos to random(count(bottles))
- put getAt(bottles, pos) into char 4 of item index of tmp
- deleteAt(bottles, pos)
- end repeat
- set comm to "set bottleNotes = [" & tmp & "]"
- do(comm)
- set index to 1
- set music to "so,so,la,so,do,si,so,so,la,so,re,do"
- set seqMaxLength to 3
- set errors to 0
- end
-
- on showNote goSwitch
- global bottleNotes, index, seqMaxLength, music
- cursor(-1)
- repeat with index = 1 to seqMaxLength
- set note to item index of music
- puppetSound(note)
- set botNum to getaProp(bottleNotes, note)
- set sprt to 9 + integer(botNum)
- puppetSprite(sprt, 1)
- set the castNum of sprite sprt to the number of cast ("bottle " & botNum & "a")
- updateStage()
- repeat while the soundBusy of 1
- end repeat
- set the castNum of sprite sprt to the number of cast ("bottle " & botNum)
- puppetSprite(sprt, 0)
- updateStage()
- end repeat
- if goSwitch then
- go("userPlay")
- end if
- end
-
- on startCheck
- global index
- set index to 1
- end
-
- on checkNote theBottle
- global bottlesNum, bottlesStrtSprt, bottleNotes, index, seqMaxLength, errors, music
- set pos to getPos(bottleNotes, theBottle)
- set note to getPropAt(bottleNotes, pos) & EMPTY
- puppetSound(note & EMPTY)
- set sprt to 9 + theBottle
- puppetSprite(sprt, 1)
- set the castNum of sprite sprt to the number of cast ("bottle " & theBottle & "a")
- updateStage()
- repeat while the soundBusy of 1
- end repeat
- set the castNum of sprite sprt to the number of cast ("bottle " & theBottle)
- puppetSprite(sprt, 0)
- updateStage()
- cursor(-1)
- if item index of music = note then
- if index = seqMaxLength then
- if seqMaxLength = the number of items in music then
- cursor(200)
- go("finished")
- else
- set seqMaxLength to seqMaxLength + 3
- set index to 1
- startTimer()
- repeat while the timer < 30
- end repeat
- go(label("start") + 1)
- end if
- else
- set index to index + 1
- cursor([8, 9])
- end if
- else
- set errors to errors + 1
- if errors = 2 then
- go("failed")
- else
- go("error1/2")
- end if
- end if
- end
-
- on myDelay theTicks
- startTimer()
- repeat while the timer < theTicks
- end repeat
- end
-
- on play1Note
- global bottleNotes, index, seqMaxLength, music
- set note to item index of music
- puppetSound(note)
- set botNum to getaProp(bottleNotes, note)
- set sprt to 9 + integer(botNum)
- puppetSprite(sprt, 1)
- set the castNum of sprite sprt to the number of cast ("bottle " & botNum & "a")
- updateStage()
- repeat while the soundBusy of 1
- end repeat
- set the castNum of sprite sprt to the number of cast ("bottle " & botNum)
- puppetSprite(sprt, 0)
- updateStage()
- set index to index + 1
- end
-