Lessons: Player health, damage, stats, resources

This commit is contained in:
Felipe M 2021-01-30 22:58:28 +01:00
parent 147199a012
commit 7842e15c6c
Signed by: fmartingr
GPG key ID: 716BC147715E716F
13 changed files with 153 additions and 18 deletions

View file

@ -0,0 +1,13 @@
extends Node
signal enemy_died
export (int) var max_health = 1
# Needs to be onready to use the max_health variable
onready var health = max_health setget set_health
func set_health(value):
health = clamp(value, 0, max_health)
if health == 0:
emit_signal("enemy_died")