How to use body_entered(Object_body) and popup()?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By hdo4ever

I’ve connected a signal between DialogueTrigger (an Area2D) and Player (KinematicBody2D):

func _on_DialogueTrigger_body_entered(body):
    if (body.get_parent().get_name() == "Player"):

so that when the Player moves into the collisionshape2D of DialogueTrigger, the Dialogue PopupPanel would show up. However, nothing happens when the Player runs into that area. I have tried signalling to the root Node instead but this results in “script inherits from native type reference so it cant be instanced in the root node”.

Anybody got any clues with this?

(the error sign next to the PopupPanel is just saying that it will be invisible unless popup() is called.)


I’ve tried adjusting the code to

func _on_DialogueTrigger_body_entered(body):
    if (body.get_name() == "Player"):

but both this and the old code doesn’t work. The debug error every time I enter the shape is displayed as:

Error calling method from signal 'body_shape_entered': 'KinematicBody2D(': Method not found.
Time: 0:00:04:0643
C Error: Error calling method from signal 'body_shape_entered': 'KinematicBody2D(': Method not found.
C Source: core\object.cpp:1202
C Function: Object::emit_signal

hdo4ever | 2018-04-14 09:41

In this last code I think you connected a different signal. Try disconnecting all the signals of the DialogTrigger and connecting just the body_entered one

Kaliga | 2018-04-14 14:21

you connected signal to _on_DialogueTrigger_body_shape_entered
but your function name is _on_DialogueTrigger_body_entered

volzhs | 2018-04-14 14:26