Browse Source

Clearification of what an action actually is. (#6200)

* Clearification of what an action actually is.

There was no definition of an action itself. I also simplified the sentence, "An InputEvent may or may not represent a predefined action" to say that actions are not required but useful (combining with the next sentence).

Without the definition, I had thought actions were pre-defined input *conditions* (input states, rather than the input itself, since an action must have it's input defined). That mess of inquiry can be read here: https://www.reddit.com/r/godot/comments/xfvmg8/can_we_define_our_own_inputanalysis_for_inputmap/ Skip to first part of my last post to see the wording that corrected my understanding of what actions were.

This is my first-ever proposal. Thank you for the opportunity to contribute to the docs and help everyone understand things a little easier.
-- Kevin
takkun324 2 years ago
parent
commit
5401294067
1 changed files with 12 additions and 8 deletions
  1. 12 8
      tutorials/inputs/inputevent.rst

+ 12 - 8
tutorials/inputs/inputevent.rst

@@ -156,16 +156,20 @@ There are several specialized types of InputEvent, described in the table below:
 Actions
 Actions
 -------
 -------
 
 
-An InputEvent may or may not represent a predefined action. Actions are
-useful because they abstract the input device when programming the game
-logic. This allows for:
+Actions are a grouping of zero or more InputEvents into a commonly
+understood title (for example, the default "ui_left" action grouping both joypad-left input and a keyboard's left arrow key). They are not required to represent an
+InputEvent but are useful because they abstract various inputs when
+programming the game logic.
+
+This allows for:
 
 
 -  The same code to work on different devices with different inputs (e.g.,
 -  The same code to work on different devices with different inputs (e.g.,
    keyboard on PC, Joypad on console).
    keyboard on PC, Joypad on console).
 -  Input to be reconfigured at run-time.
 -  Input to be reconfigured at run-time.
+-  Actions to be triggered programmatically at run-time.
 
 
 Actions can be created from the Project Settings menu in the **Input Map**
 Actions can be created from the Project Settings menu in the **Input Map**
-tab.
+tab and assigned input events.
 
 
 Any event has the methods :ref:`InputEvent.is_action() <class_InputEvent_method_is_action>`,
 Any event has the methods :ref:`InputEvent.is_action() <class_InputEvent_method_is_action>`,
 :ref:`InputEvent.is_pressed() <class_InputEvent_method_is_pressed>` and :ref:`InputEvent <class_InputEvent>`.
 :ref:`InputEvent.is_pressed() <class_InputEvent_method_is_pressed>` and :ref:`InputEvent <class_InputEvent>`.
@@ -179,8 +183,8 @@ The Input singleton has a method for this:
  .. code-tab:: gdscript GDScript
  .. code-tab:: gdscript GDScript
 
 
     var ev = InputEventAction.new()
     var ev = InputEventAction.new()
-    # Set as move_left, pressed.
-    ev.action = "move_left"
+    # Set as ui_left, pressed.
+    ev.action = "ui_left"
     ev.pressed = true
     ev.pressed = true
     # Feedback.
     # Feedback.
     Input.parse_input_event(ev)
     Input.parse_input_event(ev)
@@ -188,8 +192,8 @@ The Input singleton has a method for this:
  .. code-tab:: csharp
  .. code-tab:: csharp
 
 
     var ev = new InputEventAction();
     var ev = new InputEventAction();
-    // Set as move_left, pressed.
-    ev.SetAction("move_left");
+    // Set as ui_left, pressed.
+    ev.SetAction("ui_left");
     ev.SetPressed(true);
     ev.SetPressed(true);
     // Feedback.
     // Feedback.
     Input.ParseInputEvent(ev);
     Input.ParseInputEvent(ev);