It's more than just making a button, it's also pausing all the action onscreen, including physics and timers.
local pauseBGwhere all the other variables are initialized near the beginning of the code. Preload the
gameOverSoundnear the top of the script.
-- Place near other game variables local pauseBtn local pauseBG -- Place after gameOverSound local btnSound = audio.loadSound( "btnSound.wav" )
hud()function and after the
scoreTextchunk, create another function that will run the event for the pause button. Call the function
onPauseTouch(event). Pause the physics in the game by setting
falseand have the pause elements appear ...