(BEGINNER) Error calling from signal 'area_entered' to callable: 'CharacterBody2D(Player.gd)::_on_area_entered':

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

I’m making a game similar to flappy bird where you control a plane and have to dodge buildings, but whenever the plane touches a building, it says:
E 0:00:01:0491 emit_signalp: Error calling from signal ‘area_entered’ to callable: ‘CharacterBody2D(Player.gd)::_on_area_entered’: Method not found.
<C++ Source> core/object/object.cpp:1058 @ emit_signalp()

Side question: The plane detects collision when it’s above the building and not in the hitbox

:bust_in_silhouette: Reply From: PolyBytes

So it looks as though you have a signal connected to a method in your Player.gd script but that method does not exist.

You either need to create the method onareaentered inside your Player.gd script:

func onareaentered(area: Area2D):
  pass

or you need to disconnect that signal if you aren’t using it:
Example showing how to disconnect the signal.

With regards to your side question I couldn’t interpret what you were getting at exactly so can I have some further clarification?

I made it so when the player collides with a building, in prints “crash”, but it prints “crash” even when it doesn’t touch the building. I made it so the building loops when it goes off the screen, and it only prints “crash” incorrectly when the building has looped and when the plane is above the building.

cookieKing_ | 2023-04-30 02:00

Can I see the code where you print crash?

PolyBytes | 2023-04-30 04:01

func _on_hitbox_area_entered(buildingArea):
   print("crash")

cookieKing_ | 2023-04-30 13:48