mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
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).
26 lines
658 B
GDScript
26 lines
658 B
GDScript
extends Control
|
|
|
|
func _enter_tree() -> void:
|
|
for c in $VBoxContainer/Clients.get_children():
|
|
# So each child gets its own separate MultiplayerAPI.
|
|
get_tree().set_multiplayer(
|
|
MultiplayerAPI.create_default_interface(),
|
|
NodePath("%s/VBoxContainer/Clients/%s" % [get_path(), c.name])
|
|
)
|
|
|
|
|
|
func _ready() -> void:
|
|
if OS.get_name() == "Web":
|
|
$VBoxContainer/Signaling.hide()
|
|
|
|
|
|
func _on_listen_toggled(button_pressed: bool) -> void:
|
|
if button_pressed:
|
|
$Server.listen(int($VBoxContainer/Signaling/Port.value))
|
|
else:
|
|
$Server.stop()
|
|
|
|
|
|
func _on_LinkButton_pressed() -> void:
|
|
OS.shell_open("https://github.com/godotengine/webrtc-native/releases")
|