0 votes

I need to check if the object the script is on has collided with a KinematicBody2D.

I can't use the area_entered signal because I already used that for something else and it just wouldn't work.

Any suggestions?

in Engine by (99 points)

use signal area
func onArea2Dbodyentered(body):
if body is KinematicBody2D:
print("bla bla")
pass
Note : i think Area_entered hard except

how can I get the name?

print(bla bla )
print(body.name)

func onArea2Dbodyentered(body):
if body.name == "node name':
print("bla bla")

thanks!ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ

1 Answer

+2 votes
Best answer

I am a little bit confused. You should be able to connect multiple signals from one node, so long as you change the name of the signal and the connected function so that it's not being picked up by other code. You say that you want to check if the object has collided with a Kinematic Body but you also say you can't use the area_entered - the area_entered signal would only emit if your object has collided with an area, not a kinematic body. the body_entered signal would be more likely to work.

by (113 points)
selected by
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 Frequently asked questions and 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 [email protected] with your username.