feat: integrated some assets and made a hitbox and damage reaction system
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 5s
Create tag and build when new code gets to main / Export (push) Successful in 2m5s

This commit is contained in:
2025-08-01 17:17:00 +02:00
parent 44f083fbce
commit 6e017197f6
26 changed files with 484 additions and 449 deletions

13
damageable/damageable.gd Normal file
View File

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

View File

@ -0,0 +1 @@
uid://bhbn4pngdfk7w

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://djwoetcyvvofc"]
[ext_resource type="Script" uid="uid://bhbn4pngdfk7w" path="res://damageable/damageable.gd" id="1_qv54c"]
[node name="Damageable" type="Node"]
script = ExtResource("1_qv54c")

9
damageable/hitbox.gd Normal file
View File

@ -0,0 +1,9 @@
extends Area2D
@export var damage = 0
@export var hitback_direction = Vector2.UP
func _on_body_entered(body: Node2D) -> void:
for child in body.get_children():
if is_instance_of(child, Damageable):
child.damage(damage, hitback_direction)

1
damageable/hitbox.gd.uid Normal file
View File

@ -0,0 +1 @@
uid://dt2lsk3je41th

8
damageable/hitbox.tscn Normal file
View File

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://7sqwi3lygb1u"]
[ext_resource type="Script" uid="uid://dt2lsk3je41th" path="res://damageable/hitbox.gd" id="1_n3l2p"]
[node name="Hitbox" type="Area2D"]
script = ExtResource("1_n3l2p")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]