[SOLVED] Area2D not detecting CharacterBody2D

Godot Version

4.4.1.stable

Question

Godot and programming newbie here. I am trying to do something relatively simple - have my Area2D, when entered by the (CharacterBody2D), emit a signal that will change the value in my ProgressBar. Essentially, I’m trying to make an area that will reduce the player’s health when they enter it. However, nothing happens when the player enters the area.


Yes, both the CharacterBody2D and the Area2D have a child CollisionBody2D to define their shape. (The player is the red stick figure, the ‘damage-area’ is the godot icon.) Yes, they are both on the same Layer and Mask.

My script for the health bar. According to Godot, the area_entered signal IS connected to the script - see the green arrow and the connections popup - but nothing happens when my player enters. The health value does not change, the sound does not play, and the ‘this SHOULD be working’ string does not print in the Output.

To my understanding, the organization of my scene tree shouldn’t be relevant here, but I’ll upload a picture of it just in case:


The health bar / ProgressBar is under the MainUI node.

Any help is appreciated. Thanks in advance

The problem is that you connected the “area_entered”-signal, but not the “body_entered”-signal. The characterbody2d is a body therefore you need this signal

Facepalm, thanks. I should’ve tried messing with the other signals first.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.