0 votes

I used this code in the signal of area2d, body_entered(node: body)
I don't know why it doesn't work, please help. It says "non exsitent function "get name" in base "Nil".

func _on_potion_body_entered(body : KinematicBody2D):

if (body.get_name() == "blue"):
    Global.blue_tele = true

elif (body.get_name() == "yellow"):
    Global.yellow_tele = true
in Engine by (25 points)
edited by

1 Answer

+1 vote

it seems like it doesn't recognize a body entered, try this:

func _on_potion_body_entered(body):
    do stuff....
by (106 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.