Clicker app issue

This is my app: Code.org
For some reason, I’m not getting sent to the results screen after time is up. Can someone help me out here?

You have the variable “time” set when the project is first ran at the start, rather than setting it when the user begins the clicking.

In other words, just put your retry() function inside of the “button1” event, like so:

onEvent("button1", "click", function( ) {
  if (getText("text_input1") == 0) {
    showElement("label2");
  } else {
    retry()
    setScreen("Click");
  }
});

Also, you can add an isNaN() to the first if statement in there, in case there are any letters that the user may input;
if(getText("text_input1") == 0 || isNaN(getNumber("text_input1"))){ ...

Hope this helps!

2 Likes