|
@@ -15,20 +15,20 @@ Node structure
|
|
|
|
|
|
To begin, we need to choose a root node for the player object. As a general
|
|
|
rule, a scene's root node should reflect the object's desired functionality -
|
|
|
-what the object *is*. In the upper-left corner, in the "Scene" tab, click the
|
|
|
+what the object *is*. In the upper-left corner, in the "Scene" tab, click the
|
|
|
"Other Node" button and add an :ref:`Area2D <class_Area2D>` node to the scene.
|
|
|
|
|
|
.. image:: img/add_node.webp
|
|
|
|
|
|
-When you add the ``Area2D`` node, Godot will display the following **warning icon**
|
|
|
+When you add the ``Area2D`` node, Godot will display the following **warning icon**
|
|
|
next to it in the scene tree:
|
|
|
|
|
|
.. image:: img/no_shape_warning.webp
|
|
|
|
|
|
-This warning tells us that the ``Area2D`` node requires a shape to detect collisions or overlaps.
|
|
|
-We can **ignore the warning temporarily** because we will first set up the player's visuals
|
|
|
-(using an animated sprite). Once the visuals are ready, we will add a collision shape as a child
|
|
|
-node. This will allow us to accurately size and position the shape based on the sprite’s appearance.
|
|
|
+This warning tells us that the ``Area2D`` node requires a shape to detect collisions or overlaps.
|
|
|
+We can **ignore the warning temporarily** because we will first set up the player's visuals
|
|
|
+(using an animated sprite). Once the visuals are ready, we will add a collision shape as a child
|
|
|
+node. This will allow us to accurately size and position the shape based on the sprite's appearance.
|
|
|
|
|
|
|
|
|
With ``Area2D`` we can detect objects that overlap or run into the player.
|
|
@@ -44,8 +44,8 @@ node is clicked in 2D and 3D view."
|
|
|
|
|
|
.. image:: img/lock_children.webp
|
|
|
|
|
|
-Save the scene. Click Scene -> Save, or press :kbd:`Ctrl + S` on Windows/Linux
|
|
|
-or :kbd:`Cmd + S` on macOS.
|
|
|
+Save the scene as ``player.tscn``. Click **Scene > Save**, or press :kbd:`Ctrl + S`
|
|
|
+on Windows/Linux or :kbd:`Cmd + S` on macOS.
|
|
|
|
|
|
.. note:: For this project, we will be following the Godot naming conventions.
|
|
|
|
|
@@ -68,7 +68,7 @@ Click on the ``Player`` node and add (:kbd:`Ctrl + A` on Windows/Linux or
|
|
|
appearance and animations for our player. Notice that there is a warning symbol
|
|
|
next to the node. An ``AnimatedSprite2D`` requires a :ref:`SpriteFrames
|
|
|
<class_SpriteFrames>` resource, which is a list of the animations it can
|
|
|
-display. Make sure ``AnimatedSprite2D`` is selected and then find the ``Sprite Frames`` property under
|
|
|
+display. Make sure ``AnimatedSprite2D`` is selected and then find the ``Sprite Frames`` property under
|
|
|
the ``Animation`` section in the Inspector and click "[empty]" -> "New SpriteFrames":
|
|
|
|
|
|
.. image:: img/new_spriteframes.webp
|
|
@@ -110,7 +110,7 @@ When you're finished, your ``Player`` scene should look like this:
|
|
|
|
|
|
.. image:: img/player_scene_nodes.webp
|
|
|
|
|
|
-Once this is done, the warning on the ``Area2D`` node will disappear, as it now has
|
|
|
+Once this is done, the warning on the ``Area2D`` node will disappear, as it now has
|
|
|
a shape assigned and can interact with other objects.
|
|
|
|
|
|
Make sure to save the scene again after these changes.
|