Fire effect and ice effect

This commit is contained in:
2025-03-01 20:30:35 +01:00
parent a9f8fb717e
commit 9054777a05
7 changed files with 220 additions and 3 deletions

View File

@@ -3,6 +3,8 @@ extends Node
@export var damage: float = 0.25
@export var area2d: Area2D
@export var is_fire_brick: bool = false
@export var is_ice_brick: bool = false
func _ready() -> void:
@@ -21,10 +23,20 @@ func on_area2d_body_entered(body: Node2D) -> void:
if body.has_node("HealthComponent"):
var health_component: HealthComponent = body.get_node("HealthComponent")
var invulnerability_component: InvulnerabilityComponent = body.get_node_or_null("InvulnerabilityComponent")
var fire_effect_component: FireEffectComponent = body.get_node_or_null("FireEffectComponent")
var ice_effect_component: IceEffectComponent = body.get_node_or_null("IceEffectComponent")
if invulnerability_component and invulnerability_component.is_invulnerable():
return
if fire_effect_component and is_fire_brick:
fire_effect_component.activate()
return
if ice_effect_component and is_ice_brick:
ice_effect_component.activate()
return
deal_damage(health_component)
if invulnerability_component: