Hi there,
I added a Pause button, before realising that sometimes you can’t tell if it’s paused or not. So I went to add text that says “Paused”, to the right of the pause button. Done.
Now, it isn’t being removed when I unpause the game… even though the display.remove (pauseText) line is there. Repeatedly clicking the button makes new text over the old text (making it bolder).
So I want to remove this text!
It would be even better if I could change the button which says “Pause”, for which the event listener click runs the gamePause function, to “Paused” when it is paused and “Pause” when not paused.
Here’s my code:
local function gamePause( event )
if event.phase == “began” then
if gamePaused == false then
physics.pause()
timer.pause( gameLoopTimer)
local pauseText = display.newText(“Paused”, display.contentCenterX + 200, 920, native.systemFontBold, 40 )
gamePaused = true
elseif gamePaused == true then
physics.start()
timer.resume( gameLoopTimer)
display.remove ( pauseText )
gamePaused = false
end
end
end