Created
March 1, 2025 14:29
-
-
Save lamarmarshall/ceae22170ae140f28c7b79bf6662dd3b to your computer and use it in GitHub Desktop.
godot, gdscript, getter, setter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var current_health: int: | |
set(health_in): | |
current_health = health_in | |
print("health was changed") | |
label_3d.text = str(current_health) + "/" + str(max_health) | |
var red: Color = Color.RED | |
var white: Color = Color.WHITE | |
var blended_color = red.lerp(white, float(current_health) / float(max_health)) | |
label_3d.modulate = blended_color | |
if current_health < 1: | |
get_tree().reload_current_scene() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment