This repository has been archived on 2024-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
HoppyEaster/Scripts/EntitySystem/Bunny.gd

27 lines
424 B
GDScript3
Raw Normal View History

extends CharacterBody2D
class_name Bunny
@export var health : int
var team : int
var on_death_callbacks : Array
func damage(damage : int):
2023-04-08 15:17:48 +00:00
health -= damage
if(health <= 0): on_death()
pass
func heal(health : int):
2023-04-08 15:17:48 +00:00
self.health += health
pass
func on_death():
for callback in on_death_callbacks:
callback.call(self)
pass
func sub_on_death(callback : Callable):
on_death_callbacks.push_front(callback)
pass