0 votes

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".

asked Nov 20, 2019 in Engine by Knollewolle (14 points)

Did you preload the scene?

1 Answer

0 votes

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.

answered Nov 21, 2019 by Magso (2,713 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 How to use this Q&A? before posting your first questions.