Browse Source

Changed a few things in your_first_game:
* Changed the bit about saving the scene from "...or press Meta-s" to "...or
press Control-s for Windows/Linux or Command-s on Mac"
* Added a note about how $ is the same as get_node()
* Added a couple warnings about the error "node not found"
They explain how the node name in $ (or get_node()) is case sensitive and
encourages them to ensure the name in the script is the same as in the scene

TwistedTwigleg 7 years ago
parent
commit
19b1b483bf
1 changed files with 11 additions and 1 deletions
  1. 11 1
      learning/step_by_step/your_first_game.rst

+ 11 - 1
learning/step_by_step/your_first_game.rst

@@ -79,7 +79,7 @@ are not selectable."
 
 
 .. image:: img/lock_children.png
 .. image:: img/lock_children.png
 
 
-Save the scene (click Scene -> Save, or press ``Meta-s``).
+Save the scene (click Scene -> Save, or press ``Control+S`` on Windows/Linux or ``Command+S`` on Mac).
 
 
 .. note:: In this project, we will be following the Godot Engine naming
 .. note:: In this project, we will be following the Godot Engine naming
           conventions. Classes (Nodes) use ``CapWords``, variables and
           conventions. Classes (Nodes) use ``CapWords``, variables and
@@ -225,6 +225,12 @@ more fast diagonal movement.
 We also check whether the player is moving so we can start or stop the
 We also check whether the player is moving so we can start or stop the
 AnimatedSprite animation.
 AnimatedSprite animation.
 
 
+.. tip:: ``$`` returns the node at the relative path from this node, or returns ``null`` if the node is not found.
+         Since AnimatedSprite is a child of the current node, we can just use ``$AnimatedSprite``.
+         
+         ``$`` is the short hand for ``get_node()``.
+         So in the code above, ``$AnimatedSprite.play()`` is the same as ``get_node("AnimatedSprite").play()``.
+
 Now that we have a movement direction, we can update the player's position
 Now that we have a movement direction, we can update the player's position
 and use ``clamp()`` to prevent it from leaving the screen:
 and use ``clamp()`` to prevent it from leaving the screen:
 
 
@@ -240,6 +246,10 @@ and use ``clamp()`` to prevent it from leaving the screen:
 Click "Play the Edited Scene. (F6)" and confirm you can move the player
 Click "Play the Edited Scene. (F6)" and confirm you can move the player
 around the screen in all directions.
 around the screen in all directions.
 
 
+.. warning:: If you get an error in the "Debugger" panel that refers to a "null instance",
+             this likely means you spelled the node name wrong. Node names are case sensitive
+             and ``$NodeName`` or ``get_node("NodeName")`` must match the name you see in the scene tree.
+
 Choosing Animations
 Choosing Animations
 ~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~