feat: shield
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 6s
Create tag and build when new code gets to main / Export (push) Successful in 2m13s

This commit is contained in:
2025-08-02 21:34:08 +02:00
parent 12b02877bb
commit 02f04cc38a
6 changed files with 244 additions and 93 deletions

View File

@ -1,13 +1,20 @@
extends Node
class_name Damageable
@export var health = 3
@export var hitback_velocity: float = 500
var active = true
signal got_hit
func set_active(new_active: bool):
active = new_active
func damage(value: int = 0, direction: Vector2 = Vector2.UP):
if not active:
return
health -= value
get_parent().velocity = hitback_velocity * direction
got_hit.emit()