예제 #1
0
  public void keyReleased(KeyEvent key) {

    if (key.getKeyCode() == 37) {

      leftcheck = false;
      if (rightcheck) {
        player.ta = changet;
      } else {
        player.ta = 0;
      }
    }

    if (key.getKeyCode() == 39) {

      rightcheck = false;
      if (leftcheck) {
        player.ta = -changet;
      } else {
        player.ta = 0;
      }
    }

    if (key.getKeyCode() == 32) {

      grav = false;
    }
  }
예제 #2
0
  public void keyPressed(KeyEvent key) {

    if (key.getKeyCode() == 37) {

      leftcheck = true;
      player.ta = -changet;
    }

    if (key.getKeyCode() == 39) {

      rightcheck = true;
      player.ta = changet;
    }

    if (key.getKeyCode() == 32) {

      grav = true;
    }
  }