Browse Source

2d movement cs event par

Co-authored-by: Raul Santos <[email protected]>
HubbleCommand 11 months ago
parent
commit
8a868a4808
1 changed files with 2 additions and 1 deletions
  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();
             }