mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
Add needed signal connection steps for timers
This commit is contained in:
@@ -152,9 +152,26 @@ everything up for a new game:
|
||||
GetNode<Timer>("StartTimer").Start();
|
||||
}
|
||||
|
||||
Now connect the ``timeout()`` signal of each of the Timer nodes (``StartTimer``,
|
||||
``ScoreTimer``, and ``MobTimer``) to the main script. ``StartTimer`` will start
|
||||
the other two timers. ``ScoreTimer`` will increment the score by 1.
|
||||
Now to connect the ``timeout()`` signal of each Timer node (``StartTimer``,
|
||||
``ScoreTimer``, and ``MobTimer``) to the main script. For each of the three
|
||||
timers, select the timer within the Main node in the Scene dock, and then
|
||||
access the Node dock on the sidebar, making to have the Signals tab selected
|
||||
in the Node dock, then find and double-click the ``timeout`` signal in the
|
||||
list (or right-click and select "Connect..."). This will open a new signal
|
||||
connection dialog. The default settings in this dialog should be fine, so
|
||||
select 'Connect' to resolve the dialog box and make a new signal connection.
|
||||
|
||||
Once all three timers have this set up, you should be able to see each timer
|
||||
have a Signal connection for their respective ``timeout`` signal, showing in
|
||||
green, within their respective Signals tabs:
|
||||
|
||||
- (For MobTimer): ``_on_mob_timer_timeout()``
|
||||
- (For ScoreTimer): ``_on_score_timer_timeout()``
|
||||
- (For StartTimer): ``_on_start_timer_timeout()``
|
||||
|
||||
Now we define how each of these timers operate by adding the code below. Notice
|
||||
that ``StartTimer`` will start the other two timers, and that ``ScoreTimer``
|
||||
will increment the score by 1.
|
||||
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
Reference in New Issue
Block a user