From 95256fcccefcad0ab9a395db97d306fc0c9544b0 Mon Sep 17 00:00:00 2001 From: Techwizz Date: Tue, 16 May 2023 10:00:28 -0600 Subject: [PATCH] Added early respawn --- scenes/death.tscn | 6 +++--- scripts/death.gd | 5 ++++- scripts/global.gd | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scenes/death.tscn b/scenes/death.tscn index 4979f8c..bac32d3 100644 --- a/scenes/death.tscn +++ b/scenes/death.tscn @@ -29,9 +29,9 @@ offset_bottom = 367.0 [node name="badnewsman" type="Label" parent="."] layout_mode = 0 offset_left = 303.0 -offset_top = 208.0 +offset_top = 187.0 offset_right = 837.0 -offset_bottom = 286.0 -text = "Uhhhh I'm sorry to embarrass you but you're dead... I'm sorry to be the bearer of bad news. Maybe you'll do better in your next life huh? You'll be revived once this bar gets to 100%" +offset_bottom = 291.0 +text = "Uhhhh I'm sorry to embarrass you but you're dead... I'm sorry to be the bearer of bad news. Maybe you'll do better in your next life huh? You'll be revived once this bar gets to 100% OR YOU CAN PRESS ENTER TO RESPAWN EARLY WITH AMOUNT OF HEALTH IN BAR" horizontal_alignment = 1 autowrap_mode = 2 diff --git a/scripts/death.gd b/scripts/death.gd index 103af53..b1dc7ef 100644 --- a/scripts/death.gd +++ b/scripts/death.gd @@ -26,4 +26,7 @@ func _process(delta): Global.playerPleaseRespawn = true # Used so the Teddy script will know to reset variables and position of the player self.queue_free() $deathBar.value = deathTimer - + if Input.is_action_pressed("start_game"): + Global.playerDeathHealth = $deathBar.value + Global.playerPleaseRespawn = true + self.queue_free() diff --git a/scripts/global.gd b/scripts/global.gd index 43f5fb1..b6d579e 100644 --- a/scripts/global.gd +++ b/scripts/global.gd @@ -49,10 +49,9 @@ var spawnCotton = false # bullet will change this to true var addedMenuScene = false # Used for teddy.gd, fixes multiple menu bug var tutorialCompleted = false # Used in the save file, to know if a play should go to tutorial first var playerDisable = false # Can be used to disable the player +var playerDeathHealth = 100 # Can be changed by death.gd func _process(delta): - #if not spawnCoordsInitalized: - # spawnCoordsInitalized = true spawn_locations() if godMode: pass @@ -80,7 +79,7 @@ func player_dead(): func reset_variables(): print("Variables were reset by something") fatigue = 100 - playerHealth = 100 + playerHealth = playerDeathHealth playerDead = false playerAlive = true playerPleaseRespawn = false @@ -118,6 +117,7 @@ func reset_variables_hard(): iAmDeadAndInnocent = false addedMenuScene = false playerDisable = false + playerDeathHealth = 100 func save_data(): SettingsFile.save_data()