diff --git a/Assets/scripts/game.gd b/Assets/scripts/game.gd index 8760a83..9d4d384 100644 --- a/Assets/scripts/game.gd +++ b/Assets/scripts/game.gd @@ -1,6 +1,5 @@ extends Node3D - func _on_pause_menu_paused(): $"player".is_paused = true diff --git a/Assets/scripts/player.gd b/Assets/scripts/player.gd index 433cfd5..de863a5 100644 --- a/Assets/scripts/player.gd +++ b/Assets/scripts/player.gd @@ -4,42 +4,18 @@ extends CharacterBody3D #Condition Effect enum CONDITION {NORMAL, SPRINTING, VAPING, COUGHING, SEVERE_COUGHING} @export var current_condition = CONDITION.NORMAL -func set_condition(con): - current_condition = con - print("Setting Condition to ", con) - match con: - CONDITION.VAPING: - vapes_per_min += 1 - $Head/VapeLight.on() - $"Coughing Timer".start() - $"Severe Coughing Timer".start() - CONDITION.NORMAL: - $Head/VapeLight.off() - $"Coughing Timer".stop() - $"Severe Coughing Timer".stop() - CONDITION.COUGHING: - $Head/VapeLight.off() - $"Coughing Recovery".start() - $"Severe Coughing Timer".stop() - GlobalSettings.Player_Last_Location = global_transform.origin - CONDITION.SEVERE_COUGHING: - $Head/VapeLight.off() - $"Severe Coughing Recovery".start() - $"Coughing Timer".stop() - GlobalSettings.Player_Last_Location = global_transform.origin -var will_cough = false -var timealive = 0 -var vapes_per_min = 0 - -var current_speed const SPEED_NORMAL = 5.0 const SPEED_SPRINTING = 8.0 const SPEED_VAPING = 4.5 const SPEED_SLOWED = 3.0 const SPEED_IMMOBILE = 0.0 const JUMP_VELOCITY = 4.5 +var current_speed +var will_cough = false +var timealive = 0 +var vapes_per_min = 0 #Looking Variables var mouse_sensitivity = 0.02 @@ -97,8 +73,10 @@ func _process(delta): if vapes_per_min == randi_range(10,20): will_cough = true vapes_per_min = 0 - + func _input(event): + if event.is_action("ui_text_backspace"): + respawn() if not is_paused: if event is InputEventMouseMotion: rotate_y(-event.relative.x * mouse_sensitivity) @@ -122,6 +100,30 @@ func _input(event): if current_condition == CONDITION.SPRINTING: set_condition(CONDITION.NORMAL) +func set_condition(con): + current_condition = con + print("Setting Condition to ", con) + match con: + CONDITION.VAPING: + vapes_per_min += 1 + $Head/VapeLight.on() + $"Coughing Timer".start() + $"Severe Coughing Timer".start() + CONDITION.NORMAL: + $Head/VapeLight.off() + $"Coughing Timer".stop() + $"Severe Coughing Timer".stop() + CONDITION.COUGHING: + $Head/VapeLight.off() + $"Coughing Recovery".start() + $"Severe Coughing Timer".stop() + GlobalSettings.Player_Last_Location = global_transform.origin + CONDITION.SEVERE_COUGHING: + $Head/VapeLight.off() + $"Severe Coughing Recovery".start() + $"Coughing Timer".stop() + GlobalSettings.Player_Last_Location = global_transform.origin + func recover(): will_cough = false match current_condition: @@ -130,6 +132,9 @@ func recover(): CONDITION.SEVERE_COUGHING: set_condition(CONDITION.NORMAL) +func respawn(): + global_position = GlobalSettings.SpawnPoint + #Timers func _on_coughing_timer_timeout(): will_cough = true @@ -146,5 +151,3 @@ func _on_coughing_recovery_timeout(): func _on_severe_coughing_recovery_timeout(): recover() - -