Godot Timed Input
by hatmix
TimedInput for Godot
Adds a node type that monitors an input action for long holds, short taps and multiple taps. Can emit signals or send InputEventActions. Which events are monitored and what is done in response are configurable.
The included demo covers much of the functionality of the addon. Try out the demo at https://hatmix.itch.io/godot-timed-input
(Feb 2025 update) I probably won't be maintaining this addon and will use G.U.I.D.E instead.
TimedInput types
- Tap
- An action input pressed and released before too long (see Action Hold Delay).
- Multitap
- One or more taps quickly following an initial tap (see Action Multitap Timeout).
- Hold
- An action input continuously pressed for at least a minimum time.
Configuration options
- Action
- Name of an action from the input map to be timed
- Action Hold Delay
- How many seconds an action button/key must be held before it is a "hold" instead of a "tap"
- Action Multitap Timeout
- How many seconds after a tap can the next tap be part of a consecutive chain (multitap)
- Emit Signals
- Enable to emit signals for TimedInput types
- Send Events
- Enable to send events for TimedInput types
- Process Tap, Process Multitap, Process Hold
- Enable or disable each to react to or ignore the related TimedInput type
- Emit Holding Signal
- Enable to emit the holding signal with current total time held each physics frame, e.g. for easy progress bar updates.
- Strength Scale
- InputEventAction strength is used for the count of multitaps and duration of holds. Strength has a range of 0.0 to 1.0, so count and duration are multiplied by this scale value to get a valid strength. This is only needed in events as signals pass the actual values.
Signals
tapped (duration: float)
multitapped (count: int)
hold_started
holding (current_duration: float)
hold_finished(total_duration: float)
Events
When enabled, input actions will be added based on the action being monitored.
[action name]_tap
[action name]_multitap
[action name]_hold_started
[action name]_hold_finished
Note that events are experimental and more likely to receive breaking changes.
Motivation
This addon grew out of coding my entry for the 1-Button Jam, OBMG (One Button Mini-Golf).
Attribution
- imjp94/gd-plug used for plugin management
- bitwes/GUT used for testing
- Stopwatch icon made by Lorc. Available at game-icons.net.
Download
Support
If you need help or have questions about this plugin, please contact the author.
Contact Author