meat_madness_redux/godot/player/Overlay.gd

22 lines
560 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
func _ready():
$HurtScreen.visible = false
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.visible = true
$HurtScreen/Timer.start(1)
func _on_Timer_timeout():
$HurtScreen.visible = false