Can anyone point to a way to do this? Because with the regular ActionListener Class, and onAction, whatever it is I want it to do only performs once. For Example, I may have
> inputManager.addMapping(“Ups”, new KeyTrigger(KeyInput.KEY_W));
> inputManager.addListener(this, “Ups”);
somewhere in the code.
And in the onAction() method I have
> if (binding.equals(“Ups”)) {
> accelerationForce = accelerationForce + 5;
> vehicle.accelerate(accelerationForce);
> System.out.println(“acceleration”);
> }
This only runs whatever’s in the if once, understandably.
How do I make it so it will whatever’s in the if while the button is held, and stop running when it is let go. And maybe even do this when let go:
> vehicle.accelerate(0);