extends CanvasLayer # This is just a proof of concept, feel free to remove. # This should be triggered by some central damage taking system onready var OnFootPhysics = get_node("../OnFootPhysics") var will_fall_hard = false var in_water: int = 0 func _ready(): $HurtScreen.modulate.a = 0.0 var _ignore = GlobalEventBus.connect("player_entered_meat_sink", self, "enter_water") _ignore = GlobalEventBus.connect("player_exited_meat_sink", self, "exit_water") func enter_water(): in_water += 1 func exit_water(): in_water -= 1 func _process(delta): if OnFootPhysics.is_falling_velocity_terminal(): will_fall_hard = true if will_fall_hard and OnFootPhysics.is_on_floor(): will_fall_hard = false $HurtScreen/HurtScreenOpacityAnimation.play("opacity") if in_water: $WaterScreen.color.a = Util.clamped_lerp($WaterScreen.color.a, 0.55, delta, 0.05) else: $WaterScreen.color.a = Util.clamped_lerp($WaterScreen.color.a, 0.0, delta*5, 0.05)