Browse Source

2d movement click move update cs

HubbleCommand 11 months ago
parent
commit
a81cc1b223
1 changed files with 2 additions and 5 deletions
  1. 2 5
      tutorials/2d/2d_movement.rst

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

@@ -254,12 +254,9 @@ 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 (@event is InputEventMouseButton eventMouseButton)
+            if (Input.IsActionPressed("click"))
             {
             {
-                if (eventMouseButton.ButtonIndex == MouseButton.Left && eventMouseButton.Pressed)
-                {
-                    _target = GetGlobalMousePosition();
-                }
+                _target = GetGlobalMousePosition();
             }
             }
         }
         }