Hi Jacque,
The screen was not locked by me purposely, but at the time my handlers are executing, i am still running the "updateScreen" code as in the game academy.
That has a handler in there that locks the screen on each iteration. I believe this is running at 50 iterations a second :
Code: Select all
on dispatchUpdateScreen
local tThisFrameTime
put the long seconds into tThisFrameTime
if sStartUpdateTime is 0 then
put the long seconds into sStartUpdateTime
end if
lock screen
dispatch "updateScreen" to this card with tThisFrameTime
unlock screen
local tTheTimeNow
put the long seconds into tTheTimeNow
local tNextFrameCount
put round((tTheTimeNow - sStartUpdateTime) * sFrameRate + 0.5) into tNextFrameCount
send "dispatchUpdateScreen" to me in (sStartUpdateTime + (tNextFrameCount * (1 / sFrameRate)) - tTheTimeNow) seconds
put the result into sUpdateMessageId
end dispatchUpdateScreen
Still unsure why it would effect the way my handlers execute, if the screen happens to be locked by that "dispatchUpdateScreen" handler..?
I got round my issue in this case by using "send" for my handler. But i would love to understand why i have had to do this.
Code: Select all
on stopGame
if the environment is "mobile" then
mobileStopPlayingOnChannel "game"
end if
playSound "gameover.wav"
put false into sBubbleGameIsRunning
show button "backToMenu"
show button "gameOver"
show button "replay"
lock screen
send checkIfHighScore to this card in 500 milliseconds
unlock screen
end stopGame
So just for clarity.. the below handler, executed the "checkIfHighScore" before anything else in the handler:
Code: Select all
on stopGame
if the environment is "mobile" then
mobileStopPlayingOnChannel "game"
end if
playSound "gameover.wav"
put false into sBubbleGameIsRunning
show button "backToMenu"
show button "gameOver"
show button "replay"
wait 1 tick with messages
checkIfHighScore
end stopGame