I have an area 2D on an enemy scene, and I want to send a signal to the player whenever it is triggered. my current approach is to use the area2D’s signal to call a function stored in an autoload, though I now can’t get that feedback down to the player. I’m probably using the wrong tool for the job, but I’m not sure what else I can do. the project is based on the brackeys “make your first game” tutorial, though i’ve made some changes to it, so not everything is the same. please help!
I can’t connect two parallel scenes, so since the autolod isn’t present in the player scene, I can’t link a signal. That’s why I used a function to get to the autoload. Ideally I can hop straight from the enemy to the player without the need for the autoload.
Is there any way to do this in the editor, or do you have to do this in script?
Edit: I’m already declaring the signal in script, but I wasn’t connecting it, I was trying to use the dialogue box for that. If there is a way to do it using the dialogue box, would it work for multiple scenes?
how do you connect the signal in the code? my code passes an argument through the signal, but the connect function also wants an argument. I’ve looked at the documentation, but I don’t understand what a callable is, beyond a type of variable
when I’m trying it, it works like a regular function, including the brackets. not sure when you wouldn’t include the brackets, just putting this here for anyone looking at this post in the future.
No, the brackets mean your calling the function. This is one of those godot rules that is somewhat unclear, but if you add brackets, it’s not a reference to the function.
Ah, nevermind, I just realised I misunderstood what part you were talking about, I meant that I added brackets after the func keyword, not the signal name