Adding a scene's group to another scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Knollewolle

Good evening,

I’m trying to get into the Godot Engine by following the book “Godot Engine Game Development in 24 Hours” from Sams Teach Yourself by A. Manzur and G. Marques.

In Hour 5 there’s a sample project “Space Shooter” where several scenes are created. The root nodes are assigned to the scene’s group. So the “player” scene has a “player” group.
On the “asteroid” scene a script is applied in which is checked if the asteroid is colliding with the player or a lasershot:

func _on_asteroid_area_entered(area):
if area.is_in_group("shot") or area.is_in_group("player"): 

Now, how do I add the groups of the other scenes? In the group manager the other groups don’t show up and if I try to add them manually, by typing their names and pressing add, only the asteroids nodes show.
Groups in Godot

Also, is “area” an in built constant or do I have to define it?
Like the Sprite-‘area’ of the “asteroid” scene/node is named “spr_asteroid”.

Did you preload the scene?

Asthmar | 2019-11-20 20:03

:bust_in_silhouette: Reply From: Magso

When you load a scene e.g. the player into the main scene, the player’s group should be carried over with it. The group manager should show all the groups that are used in the current scene you’re viewing.
Also area is the parameter of area_entered so when that function is called the intersecting area can be referenced using area.