Browse Source

use csharp syntax on csharp tab (#3300)

Alexander Terry 5 years ago
parent
commit
45a404ea9f
1 changed files with 9 additions and 6 deletions
  1. 9 6
      getting_started/step_by_step/your_first_game.rst

+ 9 - 6
getting_started/step_by_step/your_first_game.rst

@@ -377,7 +377,7 @@ Let's place this code at the end of our ``_process()`` function:
             // See the note below about boolean assignment
             // See the note below about boolean assignment
             animatedSprite.FlipH = velocity.x < 0;
             animatedSprite.FlipH = velocity.x < 0;
         }
         }
-        else if(velocity.y != 0)
+        else if (velocity.y != 0)
         {
         {
             animatedSprite.Animation = "up";
             animatedSprite.Animation = "up";
             animatedSprite.FlipV = velocity.y > 0;
             animatedSprite.FlipV = velocity.y > 0;
@@ -397,11 +397,14 @@ Let's place this code at the end of our ``_process()`` function:
 
 
            .. code-tab:: csharp
            .. code-tab:: csharp
 
 
-             if velocity.x < 0:
-                 animatedSprite.FlipH = true
-             else:
-                 animatedSprite.FlipH = false
-
+             if (velocity.x < 0)
+             {
+                 animatedSprite.FlipH = true;
+             }
+             else
+             {
+                 animatedSprite.FlipH = false;
+             }
 Play the scene again and check that the animations are correct in each
 Play the scene again and check that the animations are correct in each
 of the directions. When you're sure the movement is working correctly,
 of the directions. When you're sure the movement is working correctly,
 add this line to ``_ready()``, so the player will be hidden when the game
 add this line to ``_ready()``, so the player will be hidden when the game