So basically what I am trying to do is something like this:
https://play.google.com/store/apps/deta ... .halloween
This is how far I got
Basically, at the first click the game starts and choose a random time from 2 to 4 seconds, after that the mouth start closing and if it touches you , you lose. What I can't figure how to do is making a score system(how do I make to add 1 point every time it didn't catches you) and how to make it restart (so it is ready to play again). I tryed reseting the variables.
Infos:
play=0 : not playing
play=1 : you started the game and the game has began
play=2 : it starts moving the mouth
play=3 : the mouth has fully closed
gameover=0 : you are playing
gameover=1 : mouth is opening again