So, I want to have an inventory that pauses the game whenever it's open, so kinda like Silent Hill. The issue with this is that the time stop is irregular: when the inventory is not open, if you press the inventory key (TAB), the time will stop immediately, and then various animations will play. But when the inventory is open, if you press the inventory key again, the inventory should close, but the time should return to normal after 0.5 seconds. I tried using a boolean to control the time stop, but it didn't work.
If it was just a screen that appeared instantly when pressing TAB, I would just do something like:
get_tree().paused = not get_tree().paused
But since it has all the delays and animations in between, I can't figure out how to toggle the inventory.
These are the functions I want to execute when pressing the inventory key
get_tree().paused = true
#PLay inventory fade in
InventoryActive = true
#Play inventory fade out
InventoryActive = false
get_tree().paused = false