I’m really confused here. When the game ends on the simulator and I click “retry”, no errors pop up. But when I play on my device and click retry, my player is unresponsive to the accelerometer.
in the gameover.lua
[code]
local retrybutton = display.newImage (“retryBtn.png”)
retrybutton.x = 340
retrybutton.y = 135
localGroup:insert(retrybutton
local function pressretry (event)
if event.phase == “began” then
director:changeScene (“game”)
background = nil
end
player movement in the game.lua
function movePlayer(event)
player.y = display.contentCenterY - (display.contentCenterY * (event.yGravity*3))
if player.y - player.height * 0.7 < 0 then
player.y = player.height * 0.7
elseif player.y + player.height * 0.7 > display.contentHeight
then
player.y = display.contentHeight - player.height * 0.7
end
end
Runtime:addEventListener(“accelerometer”, movePlayer)
And I am ending the frames in the game over function. I don’t know what I’m doing wrong here.
end
retrybutton:addEventListener(“touch”, pressretry)
[import]uid: 114389 topic_id: 27049 reply_id: 327049[/import]
[import]uid: 52491 topic_id: 27049 reply_id: 110234[/import]