hi guys, i’ve been learning corona for the past few weeks (not full time though as i have another business to do), but basically I’m now confused on how to make resume button appear after I pause a game and how do I make the pause button reappear when I resume the game?
I have learned from techority.com as well as searching on Google but i need more details…
here’s what i have basically
[code]local gameIsActive = true
local paused = false
local pauseBtn = display.newImage(“pause.jpg”)
pauseBtn.x = 50
pauseBtn.y = 100
–Pause function
local function pause ()
if paused == false then
physics.pause()
paused = true
gameIsActive = false
pauseBtn:removeSelf()
local resumeBtn = display.newImage(“play.jpg”)
resumeBtn.x = 50
resumeBtn.y = 100
end
end
pauseBtn:addEventListener(“tap”, pause)
local function resume ()
if paused == true then
physics.start()
paused = false
gameIsActive = true
resumeBtn:removeSelf()
local pauseBtn = display.newImage(“pause.jpg”)
pauseBtn.x = 50
pauseBtn.y = 100
end
end
resumeBtn:addEventListener(“tap”, resume)[/code]
*PS I added “if gameisactive=true” on every movement function
previously, i didnt separate the resume function from the pause function, i did it with “else if”. the code worked if I didnt add the resume button and destroy the pause button…
but I want to replace the pause button WITH the resume button when the game is paused and re-create the pause button and remove the resume button when the game is back to active, how to do that? [import]uid: 114765 topic_id: 20249 reply_id: 320249[/import]

[import]uid: 52491 topic_id: 20249 reply_id: 79095[/import]