Skip to content

Commit 65bdac5

Browse files
authored
Merge pull request #4649 from Calinou/controllers-add-is-action-just-pressed
Mention `Input.is_action_just_pressed()` on the Controllers page
2 parents dd45891 + 04d4f2b commit 65bdac5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tutorials/inputs/controllers_gamepads_joysticks.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ use ``Input.is_action_pressed()``:
121121
// `jumping` will be a boolean with a value of `true` or `false`.
122122
bool jumping = Input.IsActionPressed("jump");
123123

124+
.. note::
125+
126+
If you need to know whether an input was *just* pressed in the previous
127+
frame, use ``Input.is_action_just_pressed()`` instead of
128+
``Input.is_action_pressed()``. Unlike ``Input.is_action_pressed()`` which
129+
returns ``true`` as long as the input is
130+
held,``Input.is_action_just_pressed()`` will only return ``true`` for one
131+
frame after the button has been pressed.
132+
124133
In Godot versions before 4.0, such as 3.2, ``Input.get_vector()`` and
125134
``Input.get_axis()`` aren't available. Only ``Input.get_action_strength()``
126135
and ``Input.is_action_pressed()`` are available in Godot 3.2.

0 commit comments

Comments
 (0)