mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
make the section describing wiring up the hit signal slightly more verbose (#6480)
Co-authored-by: Max Hilbrunner <mhilbrunner@users.noreply.github.com>
This commit is contained in:
@@ -182,17 +182,19 @@ You can assign this property's value in two ways:
|
||||
property.
|
||||
- Click the down arrow next to "[empty]" and choose "Load". Select ``Mob.tscn``.
|
||||
|
||||
Next, select the ``Player`` node in the Scene dock, and access the Node dock on
|
||||
the sidebar. Make sure to have the Signals tab selected in the Node dock.
|
||||
Next, select the instance of the ``Player`` scene under ``Main`` node in the Scene dock,
|
||||
and access the Node dock on the sidebar. Make sure to have the Signals tab selected
|
||||
in the Node dock.
|
||||
|
||||
You should see a list of the signals for the ``Player`` node. Find and
|
||||
double-click the ``hit`` signal in the list (or right-click it and select
|
||||
"Connect..."). This will open the signal connection dialog. We want to make a
|
||||
new function named ``game_over``, which will handle what needs to happen when a
|
||||
game ends. Type "game_over" in the "Receiver Method" box at the bottom of the
|
||||
signal connection dialog and click "Connect". Add the following code to the new
|
||||
function, as well as a ``new_game`` function that will set everything up for a
|
||||
new game:
|
||||
signal connection dialog and click "Connect". You are aiming to have the ``hit`` signal
|
||||
emitted from ``Player`` and handled in the ``Main`` script. Add the following code
|
||||
to the new function, as well as a ``new_game`` function that will set
|
||||
everything up for a new game:
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
Reference in New Issue
Block a user