Well I thought I was on to something. Since my “wrong.lua” and “timeout.lua” overlays work properly but my “correct.lua” doesn’t and the fact that I am using “correct” as a function in the caller and using it as parameters and variables that I might be stomping on something.
I ripped all the code out of correct.lua to do nothing more that show the background image, the dismiss button and it’s call back which calls .hideOverlay().
In addition I renamed the lua file to something other than “correct” and made sure it wasn’t colliding with any variable names.
It still doesn’t remove the overlay and the game starts playing underneath it.
I’m lost.
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
local close = function ( event )
print("closing")
storyboard.hideOverlay()
end
function scene:createScene( event )
local group = self.view
local params = event.params
local questionScore = 0 --params.questionScore
local reason = "" -- params.reason
local params = event.params
if params and type( params ) == "table" then
if type( params.score ) == "number" then
questionScore = params.score
end
if type( params.reason ) == "string" then
reason = params.reason
end
end
local group = display.newGroup()
local correctBackground = display.newImageRect("images/correct.jpg", 512, 384)
correctBackground.x = display.contentWidth / 2
correctBackground.y = display.contentHeight / 2
group:insert(correctBackground)
continueButton = display.newImageRect("images/continue.png", 150, 32)
continueButton.x = display.contentWidth / 2
continueButton.y = display.contentHeight - 32
group:insert(continueButton)
continueButton:addEventListener("tap", close)
end
function scene:enterScene( event )
local group = self.view
local params = event.params
if params and type( params ) == "table" then
if type( params.score ) == "number" then
questionScore = params.score
end
if type( params.reason ) == "string" then
reason = params.reason
end
end
end
function scene:exitScene( event )
local group = self.view
end
function scene:destroyScene( event )
local group = self.view
end
scene:addEventListener( "createScene", scene )
scene:addEventListener( "enterScene", scene )
scene:addEventListener( "exitScene", scene )
scene:addEventListener( "destroyScene", scene )
return scene
Relevant bits from the calling code:
local function correctAnswer()
timer.cancel(qTimer);
countDown.isVisible = false
playerScore = playerScore + 10
scoreDisplay:setText(string.format("%07d", playerScore))
local options = {
effect = "crossFade",
time = 250,
params = {
reason=questionReason,
score=questionScore
}
}
storyboard.showOverlay( "correctans", options )
return false;
end
[import]uid: 19626 topic_id: 25750 reply_id: 104545[/import]