Files
godot-demo-projects/networking/webrtc_minimal/main.gd
Hugo Locurcio bac1e69164 Use static typing in all demos (#1063)
This leads to code that is easier to understand and runs
faster thanks to GDScript's typed instructions.

The untyped declaration warning is now enabled on all projects
where type hints were added. All projects currently run without
any untyped declration warnings.

Dodge the Creeps and Squash the Creeps demos intentionally don't
use type hints to match the documentation, where type hints haven't
been adopted yet (given its beginner focus).
2024-06-01 12:12:18 +02:00

18 lines
436 B
GDScript

extends Node
const Chat = preload("res://chat.gd")
func _ready() -> void:
var p1 := Chat.new()
var p2 := Chat.new()
add_child(p1)
add_child(p2)
# Wait a second and send message from P1.
await get_tree().create_timer(1.0).timeout
p1.send_message("Hi from %s" % String(p1.get_path()))
# Wait a second and send message from P2.
await get_tree().create_timer(1.0).timeout
p2.send_message("Hi from %s" % String(p2.get_path()))