0 votes

im making a game where you a ball with two other ball hands that float and i want to add a grab feature to it but when ever i touch the enemy my game crashes. here is the code that i used correct me please.
func onenemykillboxbodyentered(body):
if body.get('grab') == 'grab':
move_toward(grab, grab, grab)

Godot version 3.4.2
in Engine by (14 points)

this ?

if body.name == "grap":
     print("bla bla")

What error do you get? Which line causes the error?

1 Answer

0 votes

i suggests you to use groups

like this :

if body_is_in_group("ball")
   print("bla bla bla")
by (56 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 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.