godot-webrtc-mplayer-testing/global.gd

31 lines
546 B
GDScript3
Raw Normal View History

2021-11-15 15:43:33 -06:00
extends Node
2021-11-15 16:25:13 -06:00
const MultiplayerClient = preload("multiplayer_client.gd")
2021-11-15 15:43:33 -06:00
2021-11-15 16:25:13 -06:00
onready var client = MultiplayerClient.new()
2021-11-15 15:43:33 -06:00
func _ready():
2021-11-15 16:25:13 -06:00
add_child(client)
2021-11-15 15:43:33 -06:00
2021-11-17 08:18:12 -06:00
func goto_scene(scene_resource_name):
var _result = get_tree().change_scene("res://%s.tscn" % scene_resource_name)
2021-11-15 16:25:13 -06:00
2021-11-17 08:18:12 -06:00
func main_menu():
2021-11-17 13:57:45 -06:00
client.close()
2021-11-17 08:18:12 -06:00
goto_scene("main")
2021-11-15 16:25:13 -06:00
2021-11-17 08:18:12 -06:00
func start_singleplayer_game():
2021-11-17 13:57:45 -06:00
client.close()
2021-11-17 08:18:12 -06:00
goto_scene("game")
2021-11-15 15:43:33 -06:00
2021-11-17 13:57:45 -06:00
func lobby_browser():
client.close()
2021-11-17 08:18:12 -06:00
goto_scene("multiplayer")
2021-11-15 16:25:13 -06:00
2021-11-17 13:57:45 -06:00
func lobby():
goto_scene("lobby")
2021-11-17 08:18:12 -06:00
func quit():
2021-11-17 13:57:45 -06:00
client.close()
2021-11-17 08:18:12 -06:00
get_tree().quit()