Help : Clicker Game - Lives keep dropping to negative & score not update


#1

We all encounter the same problem since the numbers for lives and scores don’t get reset after we restart the game. Can anyone help my students? Thanks a lot!!


#2

Hi @awei - it looks like students are having fun with their clicker games!

It looks like the issue is that the variables of “score” and “lives” are never being re-set. At some point (either when you click the “play again” or “start” button, you should re-set the score and life variables by writing the following code:
score=0;
lives=3;

That will update the variable values. You will also want to re-set the text on the screen by calling the “setText” command when you press the “start” button but AFTER you re-set your variable values.

Hope that helps!
KT


#3

Katie,
Thanks for your help!! They indeed love the project!!

Audrey