main.gd 420 B

1234567891011121314151617
  1. extends Node
  2. const Chat = preload("res://chat.gd")
  3. func _ready():
  4. var p1 = Chat.new()
  5. var p2 = Chat.new()
  6. add_child(p1)
  7. add_child(p2)
  8. # Wait a second and send message from P1
  9. await get_tree().create_timer(1).timeout
  10. p1.send_message("Hi from %s" % String(p1.get_path()))
  11. # Wait a second and send message from P2
  12. await get_tree().create_timer(1).timeout
  13. p2.send_message("Hi from %s" % String(p2.get_path()))