mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 18:29:11 +00:00
Mention that signals are first-class types since Godot 4.0 in Using signals
(cherry picked from commit d23fe7bd8e)
This commit is contained in:
committed by
Max Hilbrunner
parent
bddca676fd
commit
52b408e4d3
@@ -25,9 +25,17 @@ For example, you might have a life bar on the screen that represents the
|
||||
player's health. When the player takes damage or uses a healing potion, you want
|
||||
the bar to reflect the change. To do so, in Godot, you would use signals.
|
||||
|
||||
.. note:: As mentioned in the introduction, signals are Godot's version of the
|
||||
observer pattern. You can learn more about it here:
|
||||
https://gameprogrammingpatterns.com/observer.html
|
||||
Like methods (:ref:`class_callable`), signals are a first-class type since Godot
|
||||
4.0. This means you can pass them around as method arguments directly without
|
||||
having to pass them as strings, which allows for better autocompletion and is
|
||||
less error-prone. See the :ref:`class_signal` class reference for a list of
|
||||
what you can do with the Signal type directly.
|
||||
|
||||
.. seealso::
|
||||
|
||||
As mentioned in the introduction, signals are Godot's version of the
|
||||
observer pattern. You can learn more about it in
|
||||
`Game Programming Patterns <https://gameprogrammingpatterns.com/observer.html>`__.
|
||||
|
||||
We will now use a signal to make our Godot icon from the previous lesson
|
||||
(:ref:`doc_scripting_player_input`) move and stop by pressing a button.
|
||||
@@ -43,8 +51,6 @@ We will now use a signal to make our Godot icon from the previous lesson
|
||||
camelCase (See :ref:`doc_c_sharp_styleguide`). Be careful to type
|
||||
the method names precisely when connecting signals.
|
||||
|
||||
.. Example
|
||||
|
||||
Scene setup
|
||||
-----------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user