waited far too long for an initial commit but here we are

This commit is contained in:
2023-11-08 14:28:55 +11:00
commit 0427a58635
299 changed files with 10191 additions and 0 deletions

27
Scripts/health.gd Normal file
View File

@ -0,0 +1,27 @@
extends Node
class_name Health
signal health_depleted
signal health_changed(health)
@export var damage_particle_scene : PackedScene
@export var max_health := 10
var current_health
func take_damage(damage):
var marker = damage_particle_scene.instantiate()
get_tree().root.add_child(marker)
marker.set_number(damage)
marker.position = get_parent().global_position + Vector3.UP
current_health -= damage
health_changed.emit(current_health)
if current_health <= 0:
health_depleted.emit()
func heal_damage(healing):
current_health += healing
if current_health > max_health:
current_health = max_health