在我的应用程序中,我有一个计时器,当玩家输掉比赛时它会暂停。
它可以工作,但是当我单击重播按钮时它会消失(我认为它在 localGroup 的第一层)
这是我使用的代码:
local myText = display.newText("", _W-30, 308, "PUSAB", 8)
myText.alpha = 1
myText:toFront()
localGroup:insert(myText)
myText:setTextColor(255, 255, 255)
local score = 0
local secDisplay = ""
local distance = 100
local function updateScore()
score = score + 1
myText.text = secDisplay..score
end
myTimer = timer.performWithDelay(distance, updateScore, 0)
local function move(event)
if(rect.x < 12) then
rect.x = 1000
scrollSpeed = 0
waveSpeed = 0
youFlewFor.alpha = 0
myText.alpha = 1
backToMenu.alpha = 1
planePlus = 0
gameOver.alpha = 1
tapToReplay.alpha = 0
pause.alpha = 0
check = 0
timer.pause(myTimer)
end
end
Runtime:addEventListener( "enterFrame", move )
它出什么问题了?