Lessons: Player health, damage, stats, resources
This commit is contained in:
parent
147199a012
commit
7842e15c6c
13 changed files with 153 additions and 18 deletions
13
metroidvania/Scenes/Enemies/EnemyStats.gd
Normal file
13
metroidvania/Scenes/Enemies/EnemyStats.gd
Normal 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")
|
Loading…
Add table
Add a link
Reference in a new issue