Skip to content

Godot 4 addon that provides signals for tap, double-tap (or more), and held input actions

License

Notifications You must be signed in to change notification settings

hatmix/godot-timed-input

Repository files navigation

TimedInput for Godot

TimedInput Icon

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

Demo App Screenshot

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

About

Godot 4 addon that provides signals for tap, double-tap (or more), and held input actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published