For any game alerts to even appear during game play, 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. To make the win and lose conditions, follow these steps:
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...