/**
  * These are our custom actions triggered by key presses. We do not walk yet, we just keep track
  * of the direction the user pressed.
  */
 public void onAction(String binding, boolean value, float tpf) {
   if (binding.equals("Left")) {
     if (value) {
       left = true;
     } else {
       left = false;
     }
   } else if (binding.equals("Right")) {
     if (value) {
       right = true;
     } else {
       right = false;
     }
   } else if (binding.equals("Up")) {
     if (value) {
       up = true;
     } else {
       up = false;
     }
   } else if (binding.equals("Down")) {
     if (value) {
       down = true;
     } else {
       down = false;
     }
   } else if (binding.equals("Jump")) {
     player.jump();
   }
 }
Beispiel #2
0
 @Override
 public void onAction(String actionName, boolean value, float lastTimePerFrame) {
   if (actionName.equals("move_up")) {
     arrowKeys[0] = value;
   } else if (actionName.equals("move_right")) {
     arrowKeys[1] = value;
   } else if (actionName.equals("move_left")) {
     arrowKeys[3] = value;
   } else if (actionName.equals("move_down")) {
     arrowKeys[2] = value;
   } else if (actionName.equals("jump")) {
     playerControl.jump();
   }
 }