Hi! How would I go about making a drag and drop feature that is from a Canvaslayer (Control) to Tilemap (Node2d). The reason for this is I'm making a drag and drop feature where I can drag the letter tile from the Tile Panel (CanvasLayer) to the board, which is a Tilemap node.
@ExploreGameDev Жыл бұрын
Hi, that's an interesting take. You might take a look at this Q&A over on ask.godotengine.org/68370/implement-drag-drop-node2d-from-control-node-space-vice-versa . looks like they've posted the code for the answer. Hope this helps.
@ericjorgearnezinochea967910 ай бұрын
Hi! Did you noted any difference performance wise?
@ExploreGameDev10 ай бұрын
Good question, I didn't profile the performance in this case. There is so little going on in this little 2D example it would probably be difficult to spot a delta. It would expect the Node version would perform better as there is "less going on" vs 2D, but it really comes down to what makes sense for the design of your game. Node has limitations, but is simpler, 2D givens you more options. Hope this helps
@ExploreGameDev2 жыл бұрын
All the code is in github: github.com/exploregamedev/Godot-demos/tree/main/DragAndDrop-part_2. In researching there seemed to be many, many ways to implement drag and drop. I'm curious to see from others what they've used. Also, there is a part one to this video here: kzbin.info/www/bejne/mX_Zq3qBeNCBjsk
@KurttBlissZ2 жыл бұрын
This is comming very handy to me. Working on drag and drop for gdscript kind of like a classic gamemaker drag and drop plugin. Hoping it can useful to me and my little brother at learning somme game dev without realizing it lol
@ExploreGameDev2 жыл бұрын
@@KurttBlissZ great to hear that this looks helpful for what you’re trying to do. Let me know if you have any questions. Enjoy your game dev journey
@KurttBlissZ2 жыл бұрын
@@ExploreGameDev Thanks I'll keep this in mind!
@KurttBlissZ2 жыл бұрын
@@ExploreGameDev Wonder how would I make this work as a plugin... Having some trouble... I want to be able to emulate the ability to drag and drop file paths into the script text editor but for code snippets with icons instead of file paths... If that makes sense.. I may get it eventually or just go a different route. Drag and drop just sounded nice.
@KurttBlissZ2 жыл бұрын
Also note sure if it mattes what type of plugin it is but this is how I'm adding it... add_control_to_dock(DOCK_SLOT_RIGHT_UR, panel_instance)
@teo28052 жыл бұрын
In love 😍
@christopheswiderski20262 жыл бұрын
For the algorithm :D
@SamKeenDev2 жыл бұрын
I'll take it , thanks :)
@nouveu12 жыл бұрын
Thanks for this video, I didn't have any idea how implement that drag'n'drop in case of Node2D so definitely will checkout your example :D I was scratching my head about when to use Control vs Node2D, there is not many resources about that matter. As I understand in general Node2D are meant for physics-heavily-influenced games and Controls are for menus and UI. So in case of drag'n'drop if you have fixed-slot-games like tic-tac-toe or solitaire Control can be used (rather as an exception than rule of thumb). And for blurry-slot-games like many RTS you have to took path of pain implementing it by hand. In the end I feel that even if Node2D allows to do more fancy stuff (animations, etc.) you will lack controls positioning capabilities... either way is bad, or maybe I misuse components.
@ExploreGameDev2 жыл бұрын
Thanks, Yeah, could certainly build a game such as a card game or tic tac toe using either Controls or Node2D's. The node2D route gives you more flexibility, but a bit more code to write. If you have a game in mind you want to build, do a lot of up front design testing (you can even use hand drawn paper pieces) to mock the gameplay and watch for interactions which would be difficult with Controls. If you don't see any, go with Controls, otherwise might be best to develop a general purpose Node2D drag and drop component.