Update 2D and 3D example file names to snake case

This commit is contained in:
Russell Sanborn
2024-06-30 08:05:53 -05:00
parent 4f1e2910de
commit d095668491
9 changed files with 18 additions and 18 deletions

View File

@@ -63,7 +63,7 @@ override the value written in the script.
.. image:: img/export_variable.webp
Your ``Player.gd`` script should already contain
Your ``player.gd`` script should already contain
a ``_ready()`` and a ``_process()`` function.
If you didn't select the default template shown above,
create these functions while following the lesson.

View File

@@ -10,7 +10,7 @@ Create a new scene and add a :ref:`Node <class_Node>` named ``Main``.
be a container for handling game logic. It does not require 2D functionality itself.)
Click the **Instance** button (represented by a chain link icon) and select your saved
``Player.tscn``.
``player.tscn``.
.. image:: img/instance_scene.webp

View File

@@ -79,7 +79,7 @@ the eye icon next to the ``Character`` or the ``Pivot`` nodes.
|image5|
Save the scene as ``Player.tscn``
Save the scene as ``player.tscn``
With the nodes ready, we can almost get coding. But first, we need to define
some input actions.

View File

@@ -246,7 +246,7 @@ smooth it out for you. It uses the *velocity* value native to the :ref:`Characte
And that's all the code you need to move the character on the floor.
Here is the complete ``Player.gd`` code for reference.
Here is the complete ``player.gd`` code for reference.
.. tabs::
.. code-tab:: gdscript GDScript
@@ -367,7 +367,7 @@ Child Scene*.
|image2|
In the popup, double-click ``Player.tscn``. The character should appear in the
In the popup, double-click ``player.tscn``. The character should appear in the
center of the viewport.
Adding a camera

View File

@@ -7,7 +7,7 @@ In this part, you're going to code the monsters, which we'll call mobs. In the
next lesson, we'll spawn them randomly around the playable area.
Let's design the monsters themselves in a new scene. The node structure is going
to be similar to the ``Player.tscn`` scene.
to be similar to the ``player.tscn`` scene.
Create a scene with, once again, a :ref:`CharacterBody3D <class_CharacterBody3D>` node as its root. Name it
``Mob``. Add a child node :ref:`Node3D <class_Node3D>`, name it ``Pivot``. And drag and drop
@@ -252,7 +252,7 @@ method. This function destroys the instance it's called on.
Our monster is ready to enter the game! In the next part, you will spawn
monsters in the game level.
Here is the complete ``Mob.gd`` script for reference.
Here is the complete ``mob.gd`` script for reference.
.. tabs::
.. code-tab:: gdscript GDScript

View File

@@ -72,7 +72,7 @@ see a list of named checkboxes.
|image4|
Next up are the ``Player`` and the ``Mob``. Open ``Player.tscn`` by double-clicking
Next up are the ``Player`` and the ``Mob``. Open ``player.tscn`` by double-clicking
the file in the *FileSystem* dock.
Select the *Player* node and set its *Collision -> Mask* to both "enemies" and
@@ -318,7 +318,7 @@ such as counting the score multiple times for one kill.
We are calling one undefined function, ``mob.squash()``, so we have to add it to
the Mob class.
Open the script ``Mob.gd`` by double-clicking on it in the *FileSystem* dock. At
Open the script ``mob.gd`` by double-clicking on it in the *FileSystem* dock. At
the top of the script, we want to define a new signal named ``squashed``. And at
the bottom, you can add the squash function, where we emit the signal and
destroy the mob.

View File

@@ -15,7 +15,7 @@ works well for hitboxes.
Hitbox with the Area node
-------------------------
Head back to the ``Player.tscn`` scene and add a new child node :ref:`Area3D <class_Area3D>`. Name it
Head back to the ``player.tscn`` scene and add a new child node :ref:`Area3D <class_Area3D>`. Name it
``MobDetector``
Add a :ref:`CollisionShape3D <class_CollisionShape3D>` node as a child of it.
@@ -213,7 +213,7 @@ Starting with ``main.gd``.
}
}
Next is ``Mob.gd``.
Next is ``mob.gd``.
.. tabs::
.. code-tab:: gdscript GDScript
@@ -308,7 +308,7 @@ Next is ``Mob.gd``.
}
}
Finally, the longest script, ``Player.gd``:
Finally, the longest script, ``player.gd``:
.. tabs::
.. code-tab:: gdscript GDScript

View File

@@ -131,7 +131,7 @@ line:
This line means that when the mob emits the ``squashed`` signal, the
``ScoreLabel`` node will receive it and call the function ``_on_mob_squashed()``.
Head back to the ``ScoreLabel.gd`` script to define the ``_on_mob_squashed()``
Head back to the ``score_label.gd`` script to define the ``_on_mob_squashed()``
callback function.
There, we increment the score and update the displayed text.
@@ -321,18 +321,18 @@ game.
|image17|
Save the scene as ``MusicPlayer.tscn``.
Save the scene as ``music_player.tscn``.
We have to register it as an autoload. Head to the *Project -> Project
Settings…* menu and click on the *Autoload* tab.
In the *Path* field, you want to enter the path to your scene. Click the folder
icon to open the file browser and double-click on ``MusicPlayer.tscn``. Then,
icon to open the file browser and double-click on ``music_player.tscn``. Then,
click the *Add* button on the right to register the node.
|image18|
``MusicPlayer.tscn`` now loads into any scene you open or play.
``music_player.tscn`` now loads into any scene you open or play.
So if you run the game now, the music will play automatically in any scene.
Before we wrap up this lesson, here's a quick look at how it works under the

View File

@@ -298,8 +298,8 @@ And with that, you finished coding your first complete 3D game.
**Congratulations**!
In the next part, we'll quickly recap what you learned and give you some links
to keep learning more. But for now, here are the complete ``Player.gd`` and
``Mob.gd`` so you can check your code against them.
to keep learning more. But for now, here are the complete ``player.gd`` and
``mob.gd`` so you can check your code against them.
Here's the *Player* script.