How to change a child nodes name after it is instantiated

Godot Version

4.2.2

Question

I have a monster raiser game where you spawn in birbs that get attacked by creatures called minibats. I need a way for the birbs to know if there is a minibat near them. I have set up an area2d to sense if something gets near. But since the minibats all get weird names the birb cannot figure out what a minibat is. Any help with this would be greatly appreciated.

You could give the mimibat a group, or a class_name and determine by that

# by group
if body.is_in_group("minibat"):

# by class_name
if body is Minibat:

docs on: Groups and class_name

1 Like

Oh, I didn’t know you could check for groups. Thanks so much!