Drag & drop in Godot part 2, comparing Control node and Node2D versions

  Рет қаралды 3,295

ExploreGameDev

ExploreGameDev

Күн бұрын

Пікірлер: 19
@starfart69
@starfart69 Жыл бұрын
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
@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.
@ericjorgearnezinochea9679
@ericjorgearnezinochea9679 10 ай бұрын
Hi! Did you noted any difference performance wise?
@ExploreGameDev
@ExploreGameDev 10 ай бұрын
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
@ExploreGameDev
@ExploreGameDev 2 жыл бұрын
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
@KurttBlissZ
@KurttBlissZ 2 жыл бұрын
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
@ExploreGameDev
@ExploreGameDev 2 жыл бұрын
@@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
@KurttBlissZ
@KurttBlissZ 2 жыл бұрын
@@ExploreGameDev Thanks I'll keep this in mind!
@KurttBlissZ
@KurttBlissZ 2 жыл бұрын
​@@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.
@KurttBlissZ
@KurttBlissZ 2 жыл бұрын
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)
@teo2805
@teo2805 2 жыл бұрын
In love 😍
@christopheswiderski2026
@christopheswiderski2026 2 жыл бұрын
For the algorithm :D
@SamKeenDev
@SamKeenDev 2 жыл бұрын
I'll take it , thanks :)
@nouveu1
@nouveu1 2 жыл бұрын
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.
@ExploreGameDev
@ExploreGameDev 2 жыл бұрын
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.
Drag and drop in Godot part 1, UI Control nodes
13:36
ExploreGameDev
Рет қаралды 14 М.
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 935 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Using Composition to Make More Scalable Games in Godot
10:13
Firebelley Games
Рет қаралды 253 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 902 М.
How To PLAN your Game as a Solo Developer
16:26
Heartbeast
Рет қаралды 528 М.
Beginner's Guide to Textures & Meshes in Godot 4
13:30
ExploreGameDev
Рет қаралды 68 М.
Smooth Drag N Drop: Godot Guide
9:28
Bramwell
Рет қаралды 50 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 691 М.
A new way to generate worlds (stitched WFC)
10:51
Watt
Рет қаралды 549 М.
How to program in Godot - GDScript Tutorial
58:10
Brackeys
Рет қаралды 847 М.
I Redesigned the ENTIRE YouTube UI from Scratch
19:10
Juxtopposed
Рет қаралды 811 М.
Large Language Models explained briefly
8:48
3Blue1Brown
Рет қаралды 981 М.