Skip to content

Commit 04d4f2b

Browse files
committed
Mention Input.is_action_just_pressed() on the Controllers page
1 parent e4c408d commit 04d4f2b

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
@@ -113,6 +113,15 @@ use ``Input.is_action_pressed()``:
113113
// `jumping` will be a boolean with a value of `true` or `false`.
114114
bool jumping = Input.IsActionPressed("jump");
115115

116+
.. note::
117+
118+
If you need to know whether an input was *just* pressed in the previous
119+
frame, use ``Input.is_action_just_pressed()`` instead of
120+
``Input.is_action_pressed()``. Unlike ``Input.is_action_pressed()`` which
121+
returns ``true`` as long as the input is
122+
held,``Input.is_action_just_pressed()`` will only return ``true`` for one
123+
frame after the button has been pressed.
124+
116125
In Godot versions before 4.0, such as 3.2, ``Input.get_vector()`` and
117126
``Input.get_axis()`` aren't available. Only ``Input.get_action_strength()``
118127
and ``Input.is_action_pressed()`` are available in Godot 3.2.

0 commit comments

Comments
 (0)