check if a node is part of a group

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By c4n4r
:warning: Old Version Published before Godot 3 was released.

hey guys!

I’m trying to make a run n gun and I’d like to check if the bullets are hiting the bad guys.

I want to use a : “_on_Area2D_body_enter(body)” event and then check if the body is member of a group (called bad_guys of exemple…).

Do you know if there’s a function to do that?

:bust_in_silhouette: Reply From: eons

You can use body.is_in_group("group name")

http://docs.godotengine.org/en/latest/classes/class_node.html?highlight=is_in_group#class-node-is-in-group