I have been looking for this for a while now.
I know that Godot has "drag and drop" functions built-in and even has a plugin demo for it but it is for GUI control nodes, not for Area2D etc. It is made for inventories, not for game controls.

My 2D game controls will be centered around this feature (touchscreens), so I am a little bit obsessing around doing it the best way possible with GDScript. I have tried many different ways overt he last few months but there are always drawbacks. The major problem was that usually, if I click and drag over another draggable element, it would then drag both at the same time. It sounds simple to fix, but I just cannot fix it properly. Also, I need to be able to add particles so that for example the dragged element leaves a trail behind it, so the solution where the element 'teleports' to the position of the next position of the mouse does not work here. I am still a beginner so I am aware that what I am asking may be too complex but I really thought that there would be some template for this. I can even pay for learning the solution if there is a udemy course which covers this properly because at this point I wasted way too much time looking everywhere.

I've made a little project available here, this one only cover D&D without any related stuff like snapping to some target places, this will be covered later in another project.

In fact, it's very easy to do and allow far better results than Controls' feature.

7 days later

Thanks for your replies guys. Right now I think that the best way to implement it is something called a 'State machine', which I did not know existed before.

    atv69404 Thanks for your replies guys. Right now I think that the best way to implement it is something called a 'State machine', which I did not know existed before.

    You're welcome and FSM (Finite State Machine) is irrelevant to D&D itself.

    Unfortunately, most tutorial author describe FSM with platform game only, whereas it is useful for pretty much any game actually cause how a game engine work (the usual issue : "wait for something", typically user's input, whereas a game SHOULD NEVER wait for something, ie stop everything, including drawing/playing music), so in __process_ function, you just have to manage the current game state and proceed to next step when all conditions required are meet (here again user's input.)