Example #1
0
  @Override
  public void key(int i, boolean bln) {
    super.key(i, bln);
    if (i == KeyCode.KEY_D) {
      right = bln;
    }
    if (i == KeyCode.KEY_A) {
      left = bln;
    }

    // scare the house the demon is nearby
    if (i == KeyCode.KEY_F) {
      boolean allScared = true;
      for (int j = 0; j < housesPosX.length; j++) {
        if (Math.abs(littleDemonPosX - housesPosX[j] + (houseNotScared.getWidth() / 2)) < 15) {
          SoundPlayer.getSoundPlayer().playScareHouse();
          // SoundPlayer.getSoundPlayer().playDemonSpeaking(); (at the same time?)
          housesScared[j] = true;
        }
        if (!housesScared[j]) {
          allScared = false;
        }
      }
      if (allScared) {
        // complete task when all the houses are scared
        setComplete(true);
        left = false;
        right = false;
      }
    }
  }
Example #2
0
  @Override
  public void key(int keycode, boolean pressed) {
    demonPlayer.key(keycode, pressed);
    // handle input for actice task (only on valid active task)

    if (!isCompletedWithTasks()
        && activeTask != null
        && activeTask == toDoList.get(nextTaskIndex)) {
      activeTask.key(keycode, pressed);
    } else {
      // if it's not the right one on the todo list then see if
      // it's one of the other tasks.
      if ((activeTask instanceof HitImpTask)
          || (activeTask instanceof InterviewTask)
          || (activeTask instanceof PaperworkTask)) {
        activeTask.key(keycode, pressed);
      }
    }
    if (keycode == KeyCode.KEY_T && pressed) {
      // System.out.println("Toggle");
      toggleToDoListVisiblity();
    }
    if (keycode == KeyCode.KEY_Z) {
      if (pressed) {
        demonPlayer.setSpeed(18);
      } else {
        demonPlayer.setSpeed(6);
      }
    }

    // to test days there will be a cheat button
    if (keycode == KeyCode.KEY_K && pressed) {
      paperworkLeft -= 90;
      // System.out.println("Complete all the things");
      for (int i = 0; i < toDoList.size(); i++) {
        toDoList.get(i).setComplete(true);
      }
      nextTaskIndex = toDoList.size();
    }
  }
Example #3
0
 @Override
 public void key(int i, boolean bln) {
   super.key(i, bln);
   if (!bln) {
     return;
   }
   if (stepOn != codes.length && i == codes[stepOn]) {
     stepOn++;
     if (stepOn == codes.length) {
       SoundPlayer.getSoundPlayer().playCoffeeBrewing();
     } else {
       SoundPlayer.getSoundPlayer().playMouseClick();
     }
   }
 }