Add terrain hit effects, progressive damage component, and update collectable signals

This commit is contained in:
2025-05-29 01:00:19 +02:00
parent 37b96c0f11
commit 26af7a591d
29 changed files with 406 additions and 22 deletions

View File

@@ -3,6 +3,8 @@ extends Node
@export var root: Node2D
@export var area2d: Area2D
@export var hit_terrain_fx: TerrainHitFx
@export var bullet_sprite: Sprite2D
func _ready() -> void:
@@ -10,9 +12,26 @@ func _ready() -> void:
area2d.area_entered.connect(on_area2d_area_entered)
func on_area2d_body_entered(_body: Node2D) -> void:
func on_area2d_body_entered(body: Node2D) -> void:
if body is TileMapLayer:
if bullet_sprite:
bullet_sprite.visible = false
play_terrain_hit_fx()
return
root.queue_free()
func on_area2d_area_entered(_area: Area2D) -> void:
root.queue_free()
func play_terrain_hit_fx() -> void:
if not hit_terrain_fx:
return
await hit_terrain_fx.trigger_fx()
root.queue_free()