Topic was automatically imported from the old Question2Answer platform.
Asked By
min
Hey there,
I have to deploy a little program for university.
I have an enemy(bird) and collecting items(apples).
What I want is:
If the bird die the apples should disappear.
If I understand your question correctly, you have a bird (kinematic body 2d) collecting apples (area 2ds) and you want all the apples to disapear when the bird dies.
To keep things simple, add an autoload script to your project and call it PlayerInfo (or whatever you like). Declare a signal inside that script:
signal player_died
Now, inside the bird script, when the bird is just about to die (before you call queue_free()) emit the signal:
PlayerInfo.emit("player_died")
Finally catch that signal inside the apple script.
First connect the signal inside the _ready() function: