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/Player/PlayerStats.gd
Normal file
13
metroidvania/Scenes/Player/PlayerStats.gd
Normal file
|
@ -0,0 +1,13 @@
|
|||
extends Resource
|
||||
class_name PlayerStats
|
||||
|
||||
var max_health = 4
|
||||
var health = max_health setget set_health
|
||||
|
||||
signal player_died
|
||||
|
||||
func set_health(value):
|
||||
health = clamp(value, 0, max_health)
|
||||
|
||||
if health == 0:
|
||||
emit_signal("player_died")
|
Loading…
Add table
Add a link
Reference in a new issue