main.gd 904 B

1234567891011121314151617181920212223242526
  1. extends Node
  2. func _ready():
  3. # Connect signals.
  4. $Button.button_up.connect($Example.emit_custom_signal, ["Button", 42])
  5. $Example.custom_signal.connect(on_signal)
  6. # Call methods.
  7. $Example.simple_func()
  8. ($Example as Example).simple_const_func() # Force use of ptrcall
  9. prints("returned", $Example.return_something("some string"))
  10. prints("returned const", $Example.return_something_const())
  11. prints("vararg args", $Example.varargs_func("some", "arguments", "to", "test"))
  12. # Use properties.
  13. prints("custom postion is", $Example.custom_position)
  14. $Example.custom_position = Vector2(50, 50)
  15. prints("custom postion now is", $Example.custom_position)
  16. # Get constants
  17. prints("FIRST", $Example.FIRST)
  18. prints("ANSWER_TO_EVERYTHING", $Example.ANSWER_TO_EVERYTHING)
  19. prints("CONSTANT_WITHOUT_ENUM", $Example.CONSTANT_WITHOUT_ENUM)
  20. func on_signal(name, value):
  21. prints("Example emitted:", name, value)