From 4d51178d32e07c070c61aa7567856bec7eda3639 Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Fri, 2 Sep 2022 23:12:33 -0700 Subject: hit/killsounds, swimming, main menu, fixed explosion physics --- scripts/GameBase.gd | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'scripts/GameBase.gd') diff --git a/scripts/GameBase.gd b/scripts/GameBase.gd index 019aa14..571ba84 100644 --- a/scripts/GameBase.gd +++ b/scripts/GameBase.gd @@ -16,6 +16,7 @@ var is_chatting = false var winddir = Vector3(1,0,0) func _process(delta): + $HUD/Health.text = str(player_char.health) if player_char != null else "" if is_local: local_server_tree.idle(delta) @@ -67,6 +68,12 @@ remote func game_update_chars(): remote func game_chat_msg(msg): $HUD.ui_chat_msg(msg) +remotesync func game_hitsound(): + $HUD.ui_play_hitsound() + +remotesync func game_killsound(): + $HUD.ui_play_killsound() + func select_character(dest): print(dest) if player_char == null: @@ -78,7 +85,20 @@ func client_disconnect(): if player_char != null: player_char.deselect_character() client.close_connection() - get_tree().quit() + if is_local: + local_server_tree.free() + back_to_main() + +func _connection_lost(): + if is_local: + local_server_tree.free() + back_to_main() + +func back_to_main(): + var main_menu = load("res://ui/MainMenu.tscn").instance() + get_tree().get_root().add_child(main_menu) + get_tree().get_root().remove_child(self) + queue_free() func join_team(team): if player_char != null: -- cgit v1.2.3