Prechádzať zdrojové kódy

2d movement cs event par

Co-authored-by: Raul Santos <[email protected]>
HubbleCommand 1 rok pred
rodič
commit
8a868a4808
1 zmenil súbory, kde vykonal 2 pridanie a 1 odobranie
  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)
         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();
                 _target = GetGlobalMousePosition();
             }
             }