소스 검색

Merge pull request #6289 from videlanicolas/patch-2

Update 'velocity' with move_and_slide
Max Hilbrunner 2 년 전
부모
커밋
1d299b65b2
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      tutorials/physics/kinematic_character_2d.rst

+ 2 - 2
tutorials/physics/kinematic_character_2d.rst

@@ -210,7 +210,7 @@ This adds simple walking support by pressing left and right:
 
         # The second parameter of "move_and_slide" is the normal pointing up.
         # In the case of a 2D platformer, in Godot, upward is negative y, which translates to -1 as a normal.
-        move_and_slide(velocity, Vector2(0, -1))
+        velocity = move_and_slide(velocity, Vector2(0, -1))
 
  .. code-tab:: csharp
 
@@ -245,7 +245,7 @@ This adds simple walking support by pressing left and right:
 
             // The second parameter of "MoveAndSlide" is the normal pointing up.
             // In the case of a 2D platformer, in Godot, upward is negative y, which translates to -1 as a normal.
-            MoveAndSlide(velocity, new Vector2(0, -1));
+            velocity = MoveAndSlide(velocity, new Vector2(0, -1));
         }
     }