netmasked/scripts/health_bar.gd

11 lines
281 B
GDScript

extends TextureRect
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
EventBus.health_changed.connect(_on_health_changed)
pass # Replace with function body.
func _on_health_changed(new : int):
texture.region = Rect2(0, new * 32, 0, 32)