Reputation: 538
I'm trying to have a finished start of the game, where when the player passes through the finish line (an area node) it will just print finished.
I set up my area with a collision shape, then connected it to my world spatial.
Then put a group on the area so when entered and is in the group it would print. But nothing happens.
func _on_Area_body_entered(body):
if body.is_in_group("Player"):
print('finished')
If I do the same code without the if body.is_in_group then it does print, but it also triggers on game first load.
Upvotes: 0
Views: 5126
Reputation: 800
Double check that your player is in the "Player" group.
Select your player in the Scene and then go to:
Or in your Player script:
func _ready():
add_to_group("Player")
Upvotes: 1