A signal is targetting multiple variables

I recently set the name to player_area and readded the signal

make sure it’s really connected, there should be a green icon on the left of the _on_player_area_body_entered function if it’s trully connected

wait, does the kill box has a body collision shape? or just area2d?
area2d with collision is not considered as body from what i know, hence it detects no killboxes

if this is the case, you will want to use this signal instead:
image
area_entered

That may be the issue as I only have a CollisionPolygon2D

wait what, the killbox is a CollisionPolygon2D? not even an Area2D base node?

Screenshot 2024-05-13 144823
Once I added the static body. It know reads it as a body but not a killbox

I have also added an or statement for the if
if body.is_in_group(“killboxes”) or body is KillBox:

so it’s area2d base, well the easy way for this without the group or even classname, is to check by the name, since we will still be using the body_entered, the StaticBody2D name should show on when player’s area2d hit this killbox’s StaticBody2D.
the thing is if the player still failed to detect the KillBox’s staticbody2d?

It now shows the name, however the if statement is not triggering

yes, dont use that now
what does the name said? StaticBody2D?
now rename the StaticBody2D node name to KillBoxBody
something like that
then in the if checking, you check it like this:
if body.name=="KillBoxBody":

Ok so when I touch the right side, I sucessfully die. However when I touch the left side nothing happens

did the print(body) print out anything when on the left?

No. But the character stops when it touches the left side but does not die. Every other side works perfectly fine

then the player area2d’s left side might actually shorter than the player’s body collision, hence the area will never touch the left side killbox

Alright. I changed so that the area collision has a pixel is a pixel larger than the player body and it works now

i wonder what even is the player scene root node is
is it a characterbody2d?
if it’s true, then there actually no need to have area2d just to detect killzone,
since the killzone itself is also using staticbody2d, then the player just need to get the collision and check if it’s a killzone

when I started to create this project, I did not create a new scene for the player. I need to convert it to one soon

Also, thank you so much man I searched everywhere and never found a clear answer until now

1 Like

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