Browse Source

Merge pull request #7676 from Varusal/master

Max Hilbrunner 2 years ago
parent
commit
6f9c56b72b
1 changed files with 1 additions and 2 deletions
  1. 1 2
      getting_started/first_2d_game/03.coding_the_player.rst

+ 1 - 2
getting_started/first_2d_game/03.coding_the_player.rst

@@ -297,8 +297,7 @@ the ``_process`` function (make sure it's not indented under the `else`):
  .. code-tab:: gdscript GDScript
  .. code-tab:: gdscript GDScript
 
 
         position += velocity * delta
         position += velocity * delta
-        position.x = clamp(position.x, 0, screen_size.x)
-        position.y = clamp(position.y, 0, screen_size.y)
+        position = position.clamp(Vector2.ZERO, screen_size)
 
 
  .. code-tab:: csharp
  .. code-tab:: csharp