Преглед изворни кода

Merge pull request #3616 from Calinou/2d-movement-input-action-note

Add a note to remind the user to set up input actions in 2D movement
Max Hilbrunner пре 5 година
родитељ
комит
b85b7706b6
1 измењених фајлова са 9 додато и 1 уклоњено
  1. 9 1
      tutorials/2d/2d_movement.rst

+ 9 - 1
tutorials/2d/2d_movement.rst

@@ -13,6 +13,8 @@ the movement in most 2D games is based on a small number of designs.
 We'll use :ref:`KinematicBody2D <class_KinematicBody2D>` for these examples,
 but the principles will apply to other node types (Area2D, RigidBody2D) as well.
 
+.. _doc_2d_movement_setup:
+
 Setup
 -----
 
@@ -98,7 +100,7 @@ Add a script to the kinematic body and add the following code:
         }
     }
 
-In the ``get_input()`` function we check for the four key events and sum them
+In the ``get_input()`` function, we check for the four key events and sum them
 up to get the velocity vector. This has the benefit of making two opposite keys
 cancel each other out, but will also result in diagonal movement being faster
 due to the two directions being added together.
@@ -109,6 +111,12 @@ its *length* to ``1``, and multiply by the desired speed.
 .. tip:: If you've never used vector math before, or need a refresher,
          you can see an explanation of vector usage in Godot at :ref:`doc_vector_math`.
 
+.. note::
+
+    If the code above does nothing when you press the keys, double-check that
+    you've set up input actions correctly as described in the
+    :ref:`doc_2d_movement_setup` part of this tutorial.
+
 Rotation + movement
 -------------------