Hi,
I'm sniffing about, but can't quite spot the answer to this one.
I want to have a "fire" button (spacebar). I want the fire button to the full press and release of the spacebar. However, at the moment, keeping my finger on the spacebar produces a constant stream of missiles.
I could add some sort of delay check, but what I would really like is to ensure that the player has released the spacebar before firing (I'll probably add a minimum delay as well later).
Here's what I'm doing:
private void init() {
KeyBindingManager.getKeyBindingManager().set("fire", KeyInput.KEY_SPACE);
}
protected void update(float tpf) {
if(KeyBindingManager.getKeyBindingManager().isValidCommand("fire")) {
// create a missile and attach a movement controller
}
}
Please help !