Ejemplo n.º 1
0
  private void configureRight() {
    scene.addEventHandler(
        KeyEvent.KEY_PRESSED,
        (key) -> {
          if (key.getCode() == KeyCode.D) {
            keys.setRight();
          }
        });

    scene.addEventHandler(
        KeyEvent.KEY_RELEASED,
        (key) -> {
          if (key.getCode() == KeyCode.D) {
            keys.releaseRight();
          }
        });
  }
Ejemplo n.º 2
0
  private void configureForward() {
    scene.addEventHandler(
        KeyEvent.KEY_PRESSED,
        (key) -> {
          if (key.getCode() == KeyCode.W) {
            keys.setSlowForward();
          }
        });

    scene.addEventHandler(
        KeyEvent.KEY_RELEASED,
        (key) -> {
          if (key.getCode() == KeyCode.W) {
            keys.releaseSlowForward();
          }
        });
  }