0

365体育足球滚球比分I was trying to make keyboard game, if you type same letters with the given text for each letter you gain 1 score but i couldn't calculate the errorCount with code below , so losing condition is not working and game always goes on, so how can i calculate error count and at 5 error finish game.

if (myController.text[y] == textp2[y]) {
                setState(() {
                  check = true;
                  score += 1 * (myController.text.length - score);

                  y++;
                });

                if (score == length) {
                  showDialog(
                    context: context,
                    builder: (context) {
                      return AlertDialog(
                        content: Text("YOU WON !!!!"),
                      );
                    },
                  );
                } else {

                  setState(() {
                    Timer.periodic(
                        Duration(
                          seconds: 1,
                        ), (timer) {
                      errorCount++;
                    });
                    if (errorCount == 4) {
                      return AlertDialog(
                        content: Text("GAME OVER"),
                      );
                    }
                  });
                }
              }
            });
| improve this question | | | | |
  • Can you dop your whole code? – Locked Mar 26 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy365体育足球滚球比分

Browse other questions tagged or ask your own question.