mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
Merge pull request #9562 from russellsanborn/update-played-gd-filename
Update Dodge the creeps file names to snake case
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user