'Can i remove Inputs and Actions from a java FXGL game
We are using FXGL to programm a little game. At the beginning we initialized a few UserActions with KeyCodes for inputs. But later this UserActions shall get deleted/removed.
I found the possibility to rebind an action to a new the KeyCode. But i can't figure out, how to remove this action.
This is what i found and use actually to rebind the Action EXIT_GAME from KeyCode.D to KeyCode.L:
public static void initializeGameInputs(){
//Todo delete this workaround for waiting time - otherwise game crashes
getInput().mockKeyRelease(KeyCode.G);
getInput().mockKeyRelease(KeyCode.H);
getInput().rebind(getInput().getActionByName(EXIT_GAME), KeyCode.L);
getInput().rebind(getInput().getActionByName(START_GAME), KeyCode.K);
getInput().addAction(new WalkUserAction(), KeyCode.D, VirtualButton.RIGHT);
getInput().addAction(new WalkLeftUserAction(), KeyCode.A, VirtualButton.LEFT);
getInput().addAction(new JumpUserAction(), KeyCode.W, VirtualButton.UP);
}
But i want to delete this action. Thank you a lot for your help!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
