Godot 4.3
Hello! I have made this enemy but for some reason it won’t die when it’s hit. The sounds will play but, nothing happens.
func _ready() -> void:
max_value = 6
min_value = 0
value = 6
# Called when the node enters the scene tree for the first time.
func _on_radius_area_entered(area: Area2D) -> void:
if area.is_in_group("Owie 1"):
value -= 1
$"../AudioStreamPlayer2D2".play()
if area.is_in_group("Owie 2"):
value -= 1
$"../AudioStreamPlayer2D2".play()
print(area.is_in_group("Owie 1")) # does this print anything?
print(area.is_in_group("Owie 2")) # does this print anything?
# check value here, as it's *after* the value has been changed
if value <= 0: # make sure to check *less than* or equal to zero
$"../death".play()
func _on_death_finished() -> void:
get_parent().queue_free()