-- Art Puzzle game Handlers -----------------------------
-- *** NOTE: You must set the correct sprite numbers and cast numbers in the GeoMosaicDrag handler ***
on initializePuzzleGame
global introNarration,beginnerNarration
global intermediateNarration,placedItemSprites
global advancedNarration,terribleNarr,averageNarr,goodNarr,successNarr, finish
-- set names of soundFiles
set beginnerNarration = "LFPLAY5.AIF"
set intermediateNarration = "LFPLAY4.AIF"
set advancedNarration = "LFPLAY3.AIF"
set terribleNarr = "LFPLAY6.AIF"
set goodNarr = "LFPLAY8.AIF"
set successNarr = "LFPLAY9.AIF"
set averageNarr = "LFPLAY7.AIF"
set placedItemSprites = []
set finish = FALSE
end
on zeroTotalCorrect
global totalCorrect
put 0 into totalCorrect
end zeroTotalCorrect
on setTime allotedTime
global allotedSeconds
put allotedTime into allotedSeconds
set the text of cast "GameTimer" to string(allotedSeconds)
end
on playNarration aNarration
sound playFile 2, aNarration
waitSound 2
sound stop 2
end
-- not interruptable by pressing mouse
on playNarrationNoInterrupt aNarration
sound playFile 2, aNarration
waitSoundNoInterrupt 2
sound stop 2
end
on startGeoGame
global gameStartTicks
timeOutOff
when mouseDown then GeoMosaicDrag
put the ticks into gameStartTicks
zeroTotalCorrect
puppetSound "Start Game"
end startGeoGame
on endGeoGame
when mouseDown then nothing
--puppetSound 0
end endGeoGame
on setPuppets firstPiece,lastPiece,status
repeat with currSprite = firstPiece to lastPiece
puppetSprite currSprite,status
end repeat
end
on GeoMosaicDrag
global placedItemSprites
put the clickOn into whichSprite
if (whichSprite >= 5) and (whichSprite <= 24) and (the castNum of sprite whichSprite >=1) and (the castNum of sprite whichSprite <=40) and getOne(placedItemSprites,whichSprite) = 0 then TrackAndCheck (whichSprite, 2, 5, 4, "RS")
end GeoMosaicDrag
on updateGameTimer
global gameStartTicks,allotedSeconds,gameOver
put allotedSeconds - ((the ticks - gameStartTicks) / 60) into gameSecondsRemain
set the text of cast "GameTimer" to string(gameSecondsRemain)
if gameSecondsRemain <= 0 then
waitticks 30 -- so you hear the "correct" sound onfast computers
set gameOver = TRUE
finished
end if
end updateGameTimer
on gameOutOfTime
global totalCorrect,terribleNarr,averageNarr,goodNarr
if TotalCorrect >= 0 AND TotalCorrect < 8 then set result = terribleNarr
if TotalCorrect >= 8 AND TotalCorrect < 16 then set result = averageNarr
if TotalCorrect >= 16 AND TotalCorrect <= 20 then set result = goodNarr