meat_madness_redux/godot/player/Overlay.gd

31 lines
995 B
GDScript3
Raw Normal View History

2022-11-27 21:06:36 -07:00
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
2022-12-27 20:06:15 -07:00
var in_water: int = 0
2022-11-27 21:06:36 -07:00
func _ready():
2022-12-11 17:02:57 -07:00
$HurtScreen.modulate.a = 0.0
2022-12-27 20:06:15 -07:00
var _ignore = GlobalEventBus.connect("player_entered_meat_sink", self, "enter_water")
_ignore = GlobalEventBus.connect("player_exited_meat_sink", self, "exit_water")
2022-11-27 21:06:36 -07:00
2022-12-27 20:06:15 -07:00
func enter_water():
in_water += 1
func exit_water():
in_water -= 1
func _process(delta):
2022-11-27 21:06:36 -07:00
if OnFootPhysics.is_falling_velocity_terminal():
will_fall_hard = true
if will_fall_hard and OnFootPhysics.is_on_floor():
will_fall_hard = false
2022-12-11 17:02:57 -07:00
$HurtScreen/HurtScreenOpacityAnimation.play("opacity")
2023-01-03 12:20:47 -07:00
if in_water and Util.meat_sink_parameters.mind_fuck:
2022-12-27 20:06:15 -07:00
$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)