I am making a Pause button that when pressed will pause the action. What I want to achieve is pressing the Pause button a second time to restart the action. Then pause again, start again. Here is the code that will pause the action. So when I press again I would like ‘timer.resume(tmr1)’ and ‘physics.start(true)’ to be activated. Thanks for help!
onButtonEvent3 = function (event )
if event.phase == “began” then
audio.play(s5)
elseif event.phase == “ended” then
timer.pause(tmr1)
physics.pause()
--timer.resume(tmr1)
--physics.start(true)
end
end
myButton3 = widget.newButton{
defaultColor = { default={ 255, 0, 0 }, over={ 0, 0, 255} },
id = “btn001”,
label = “pause”,
fontSize=10,
left = 0,
top = 115,
width =55, height = 50,
onEvent = onButtonEvent3
}
group:insert(myButton3)
This is what you had in mind?