Created
October 13, 2019 13:06
-
-
Save KinoAR/cd5343a64ab493583fe7d06244657d93 to your computer and use it in GitHub Desktop.
An example of using the dollar sign operator access a specific property on an object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func die()->bool: | |
| hide() | |
| # Accessing the node NAMED CollisionShape2D in the UI. | |
| # If There were subchildren of that node, we'd access it like so $CollisionShape2D/ChildNode | |
| $CollisionShape2D.set_deferred("disabled", true) | |
| queue_free() | |
| return true | |
| # Alternate Syntax | |
| func die_type_2()->bool: | |
| hide() | |
| # Accessing the node NAMED CollisionShape2D in the UI. | |
| # This syntax is useful if you want to chain gets with the dot operator; dollar sign does not work with the operator. | |
| get_node("CollisionShape2D").set_deferred("disabled", true) | |
| queue_free() | |
| return true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment