My code is not working correctly, please help.

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

Im following a tutorial that is slightly out of date i think, but I have been stuck on this for a long time. This is my code:

extends CharacterBody2D

var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var player

func _physics_process(delta):
	#crab gravity
	velocity.y += gravity * delta

func _on_player_detection_body_entered(body):
	if == "Player":
		player = get_node("../../player")
		var direction = (player.position - self.position)
		if direction.x > 0:

Whenever I run it I get this error:

E 0:00:03:0009   emit_signalp: Error calling from signal 'body_entered' to callable: 'CharacterBody2D(': Method not found.
  <C++ Source>   core/object/object.cpp:1058 @ emit_signalp()

Any idea whats wrong?

Edited to fix forum code formatting…

jgodfrey | 2023-06-25 21:02

I fixed it nevermind.

powerplayerplus | 2023-06-25 21:14

:bust_in_silhouette: Reply From: Patrick_W

It says that your is calling a function called


but that this function does not exist.
Could it be that you renamed the function to


but the Area2D is still connected to the old function ?