1
Fork 0
mirror of https://github.com/RYGhub/the-cold-night.git synced 2024-11-21 20:24:20 +00:00

Create Damageable behaviour

This commit is contained in:
Steffo 2022-04-03 08:19:52 +02:00
parent 62220e1126
commit 113a68bda3
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,18 @@
extends Node
export var health: int = 1 setget set_health, get_health
export var max_health: int = 1
signal health_changed(value)
signal dead
func set_health(value):
health = value
emit_signal("health_changed", value)
if health <= 0:
emit_signal("dead")
func get_health():
return health

View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://src/entities/behaviours/Damageable.gd" type="Script" id=1]
[node name="Damageable" type="Node"]
script = ExtResource( 1 )