Explorar o código

2d movement cs event par

Co-authored-by: Raul Santos <[email protected]>
HubbleCommand hai 1 ano
pai
achega
8a868a4808
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      tutorials/2d/2d_movement.rst

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

@@ -254,7 +254,8 @@ on the screen will cause the player to move to the target location.
 
         public override void _Input(InputEvent @event)
         {
-            if (Input.IsActionPressed("click"))
+            // Use IsActionPressed to only accept single taps as input instead of mouse drags.
+            if (@event.IsActionPressed("click"))
             {
                 _target = GetGlobalMousePosition();
             }