예제 #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
    public void mPressed(float mx, float my) {

      if (!didPressInfo) {
        if (b1.isClicked(mx, my)) {
          b1.col = c.gray;
          b2.col = c.white;
          b3.col = c.white;
          didPressInfo = true;
          didPressStart = false;
        } else if (b2.isClicked(mx, my)) {
          b1.col = c.white;
          b2.col = c.gray;
          b3.col = c.white;
          didPressInfo = false;
          didPressStart = true;
        }
      } else if (didPressInfo) {
        if (b3.isClicked(mx, my)) {
          b1.col = c.white;
          b2.col = c.white;
          b3.col = c.gray;
          didPressInfo = false;
          didPressStart = false;
        }
      }

      if (easy.isClicked(mx, my)) {
        easy.col = c.gray;
        medium.col = c.white;
        hard.col = c.white;
        difficulty = 0;
      } else if (medium.isClicked(mx, my)) {
        easy.col = c.white;
        medium.col = c.gray;
        hard.col = c.white;
        difficulty = 1;
      } else if (hard.isClicked(mx, my)) {
        easy.col = c.white;
        medium.col = c.white;
        hard.col = c.gray;
        difficulty = 2;
      }

      if (exit.isClicked(mx, my)) {
        exit();
      }
    }
예제 #3
0
 public void mPressed(float mx, float my) {
   if (startButton.isClicked(mx, my)) {
     startBool = true;
   }
 }