From 90607106baba9101ea386f04fa3703429cfc1873 Mon Sep 17 00:00:00 2001 From: tpart Date: Sun, 11 Aug 2024 00:13:44 +0200 Subject: Reset camera view when lobby is entered --- client/player/follow_camera.gd | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/client/player/follow_camera.gd b/client/player/follow_camera.gd index ec260ee5..41f99d97 100644 --- a/client/player/follow_camera.gd +++ b/client/player/follow_camera.gd @@ -58,9 +58,12 @@ func _process(delta): func _input(_event): if disable_input: return if Input.is_action_just_pressed("reset"): - angle_target = 0 - angle_up_target = 1 - camera_distance_target = 10 + reset() + +func reset(): + angle_target = 0 + angle_up_target = 1 + camera_distance_target = 10 func follow(delta): if not disable_input: angle_target += Input.get_axis("rotate_left", "rotate_right") * ( @@ -105,4 +108,9 @@ func follow(delta): func set_ingame(state: bool, in_lobby: bool): # Disable input in lobby - disable_input = state and in_lobby + if state and in_lobby: + reset() + disable_input = true + else: + disable_input = false + -- cgit v1.2.3-70-g09d2