For any game alerts to even appear during gameplay, we need to create some if
statements for every possible scenario available in each level. When this occurs, the score needs to be reset back to zero.
Below the
alertScreen()
function, create a new function calledrestart()
:function restart()
Create an
if
statement for a"win"
game event when the first level has been completed and transitions to Level 2.if gameEvent == "win" and currentLevel == 1 then currentLevel = currentLevel + 1 changeLevel2() levelNum.text = tostring(currentLevel)
Add an
elseif
statement for a"win"
game event when the second level has been completed and notifies the player that the game has been completed...