diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2022-09-02 23:12:33 -0700 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2022-09-02 23:12:33 -0700 |
| commit | 4d51178d32e07c070c61aa7567856bec7eda3639 (patch) | |
| tree | 7ef4884dd2221340f9c1ed96bd0f52c761ae9fb0 /scripts/GameBase.gd | |
| parent | 0939d84e611f1c63fd5805339a2f777251fb1653 (diff) | |
hit/killsounds, swimming, main menu, fixed explosion physics
Diffstat (limited to 'scripts/GameBase.gd')
| -rw-r--r-- | scripts/GameBase.gd | 22 |
1 files changed, 21 insertions, 1 deletions
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: |
