예제 #1
0
    public void mPressed(float mx, float my) {

      if (nextButton.isClicked(mx, my) && isWordCorrect) {
        checkButton.enabled = true;

        wordIndex = wordIndex + 1;
        if (wordIndex >= 10) {
          if (!level1.isComplete()) {
            level1.complete = true;
          } else if (!level2.isComplete()) {
            level2.complete = true;
          } else if (!level3.isComplete()) {
            level3.complete = true;
          }
          wordIndex = 0;
        }
        isWordCorrect = false;
        tfs.setUserWord("");
      } else if (checkButton.isClicked(mx, my) && checkButton.enabled) {
        if (tfs.getTesterWord().equals(tfs.getUserWord())) {
          print("Correct\n");
          checkButton.enabled = false;
          isWordCorrect = true;
          score.incrementScore();
        } else {
          print("Wrong\n");
          if (score.getScore() > 0) {
            score.decrementScore();
          }
        }
      }

      if (startOver.isClicked(mx, my) && level2.isComplete()) {
        quitPressed = true;
      }

      if (quit.isClicked(mx, my)) {
        quit.col = c.gray;
        quitPressed = true;
      }

      if (!level1.isComplete()) {
        if (!level1.didStart()) {
          level1.mPressed(mx, my);
          if (level1.didStart()) {
            checkButton.enabled = true;
          }
        }
      } else if (!level2.isComplete()) {
        if (!level2.didStart()) {
          level2.mPressed(mx, my);
        }
      } else if (!level3.isComplete()) {
        if (!level3.didStart()) {
          level3.mPressed(mx, my);
        }
      }

      tfs.mPressed(mx, my);
    }
예제 #2
0
    Levels() {
      quit.col = c.white;

      checkButton.enabled = false;
    }