Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of using the dollar sign operator access a specific property on an object.
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