Player inputs signal to area2d

Godot Version

4.2

Question

How can I get the input key when my char stand in Area2D. In example - when char enters in area it’s emit signal body_entered, but I want somthing like char`s input emit signal to Area2D if char is in that area.
And can I get that Area2D in wich my char stand?

Hi, it’s a little difficult to understand your question, but here’s what I’m interpreting.

It sounds like you have some sort of player node that can receive inputs and move around. It also sounds like you might have those tied to signals, but I’m not sure. You also have an Area2D which the player can then collide with. When and only when the player is inside the Area2D, you want to have some custom behavior for your input.

In any cause you’ll be using the area_entered and area_exited functions of Area2D to keep track of this state. It’s also possible you might also be using body_entered/exited.

If your player has output signals that you want to connect to something inside your Area2D this should be helpful. Connecting to a signal with code

Hope that helps. In the future a little more context and example of what you’re trying to do will make it easier to figure out what’s going on :slight_smile:

Hi, you get it right and actually help me, thank you!

Sorry for such short information (it’s my first topic in this source)