Drag and Drop Inventory System | Godot Tutorial

  Рет қаралды 33,873

Game Development Center

Game Development Center

Күн бұрын

Пікірлер: 81
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
All the tutorials I made are free. All the tutorials I will make will be free. Support this vision by joining the YT member club, or with a pledge on Patreon: kzbin.infojoin www.patreon.com/gamedevelopmentcenter
@SilverDungeoneer
@SilverDungeoneer 9 ай бұрын
Don't know who may see this. But if you're in godot 4+, rect_size was changed to size. So if you're as confused as I was for a hot minute. That may be why
@alcothzeither261
@alcothzeither261 8 ай бұрын
Thanks for the info, I could've gotten stuck here for a while trying to figure out why it didn't work
@nicolasdalianides4973
@nicolasdalianides4973 2 жыл бұрын
At 8:00 minutes in the video you can save some time by ctrl + clicking all the icon nodes that you want to add the Equipment.gd script to and then drag and drop the Equipment.gd script in the inspector window at the very bottom where the Script property is located, that should add the script to the selected nodes. Thank you for the tutorials
@Remissius
@Remissius 3 жыл бұрын
First let me say that I've been scouring GameDev tutorials and engine docs since the glory days of vanilla WoW and you sir are doing great things here. If I could go back in time with your tutorials and Godot engine (icon.png 4 life) as a starting point I can't imagine how much further I'd be. Keep up the great work. :)
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Wow, thanks Jasim! I'm happy to hear my content is so well received :)
@NarZeL7
@NarZeL7 3 жыл бұрын
Thanks Stefan, thanks for your courage in checking out rare topics in godot on youtube, keep going bro
@Sean-gx1sf
@Sean-gx1sf Жыл бұрын
I'm making a card game; this has been incredibly useful to me since many of the same concepts apply
@nobutadas
@nobutadas 2 жыл бұрын
Really appreciate the tutorials! And I really appreciate the speed at which you go! As a new user with Godot, it's nice to see HOW you layout all of your GUIs.
@GameDevelopmentCenter
@GameDevelopmentCenter 2 жыл бұрын
Welcome aboard! :)
@pelicano1987
@pelicano1987 3 жыл бұрын
Thank you, specially for going function through function explaining, allowing us to learn. Already implemented variations of your 2 previous videos, hope to implement this code soon. But before I do that and fiddle around with it, I'm already wandering a few things, like how to discard items in a trash bin slot or a shop/trade/loot/chest menu. Again, thank you and keep up the good work!
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Yeah, I got some more episodes coming with things like a hover display with item information, I think I will do the trashcan bit too. Shop/trade/loot is really just another window and very similar code :)
@Rikikiz
@Rikikiz Жыл бұрын
Excellent tutorial ! I lIke the way you actually explain why you are doing stuff
@sestalacto
@sestalacto 3 жыл бұрын
Thanks man I love your videos!
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
That great to hear Cesar :) Thx!
@USNTM2
@USNTM2 3 жыл бұрын
Hey, Stephan, letting you know that there were reports of people using the "== null" or "!= null" and it blowing up production projects. There was the offering of using "is_instance_valid()" as opposed to checking against nulls. Food for thought, Sir. Keep up the great work!
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Thx Kevin! Always good to sharpen those practices!
@USNTM2
@USNTM2 3 жыл бұрын
Yup. Flipping through the code and altering this for my uses, I found that giving an initial item requires a "!= null" during the iterations. So, I'm guessing it's different when reading through a dictionary loaded from JSON.
@USNTM2
@USNTM2 3 жыл бұрын
@@GameDevelopmentCenter Okay. Now I am getting into the dragging. It seems to break the code that you've got. So, please, for this tutorial and your purposes, keep yours the same. :( I am sorry if you've already altered your code... I feel like a jackass at this point.
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
@@USNTM2 Life of a gamedev, yes/no, left/right. Glad you sharing your thoughts and experiences. It is how we all learn :)
@AdredenGaming
@AdredenGaming 3 жыл бұрын
I have really found this a useful set of tutorials. Thank you for making them. images/icon were a lot of trouble and debugging would have been easier if it were on git hub,( CR issues I bet are involved). Thank you though for all the information and ways to think about things. Look forward to learning more from you
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Thx Adreden, yeah cr for the assets. Code is available for supporters. Looking forward to make more tutorials :)
@jamie9926
@jamie9926 2 жыл бұрын
Great video - so well explained!
@artourprice2435
@artourprice2435 Жыл бұрын
Really appreciate the tutorials! Great help!
@PrimoNelson
@PrimoNelson 3 жыл бұрын
Always get so much from your vids. Top man x
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Glad you like them! Thx Primo :)
@darthgame2133
@darthgame2133 3 жыл бұрын
hello your videos are incredible! I have an error this showing how (invalid get index 'Item' on base: 'float'). I checked the icons and the paths and it is correct what will that be?
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Jump on discord and share a screenshot :)
@rl_ledge9284
@rl_ledge9284 3 жыл бұрын
Awesome tutorial, how would you go about saving the current inventory and charactersheet and it saving again once a item has been swaped? Could you make a tutorial about this?
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
There are a ton of save and load tutorials out there :) You can use any one of them :)
@shirotonbo6315
@shirotonbo6315 Жыл бұрын
Hello, how do I change the z index of dragged data, its behind the sprite of the item (not the whole node, just the sprite) any ideas. Ive watched the video so many times, everything is working as expected just this one thing its really stressing me out.
@GameDevelopmentCenter
@GameDevelopmentCenter Жыл бұрын
You either have to set it above parent with a function or change the order of the nodes in the node tree. I can't help much more than this without screenshots. Join the Discord if you remain stuck.
@shirotonbo6315
@shirotonbo6315 Жыл бұрын
@@GameDevelopmentCenter Thank you man! Yes it was the parents fault. It worked!
@jaredw.7712
@jaredw.7712 Жыл бұрын
I don't know if you're still around or not. But I'm wondering if it's possible to hide the control while dragging and make it show again if I stop dragging but the control didn't enter a draggable zone
@GameDevelopmentCenter
@GameDevelopmentCenter Жыл бұрын
Not sure what you mean, probably a whole lot easier to show what you mean on Discord :)
@neeshchiiking
@neeshchiiking 2 жыл бұрын
I wanted to have multiple inventory pages to separate my weapons, items, quest items, etc. would I have to do this process multiple times to do that or is there a simpler way? Thank you again for your informative tutorials
@GameDevelopmentCenter
@GameDevelopmentCenter 2 жыл бұрын
No, you would probably add some filter icons and reload the inventory. In the load inventory code you will have to apply the filter
@-GIGA-
@-GIGA- 3 жыл бұрын
I'm curious as to why you prefer using JSON and dictionaries for items as opposed to Godots' resource files? I've found only a handful of tutorials that really explain resources and I didn't quite get what's so special about them. I'm developing a little 2D game that has a ton of clothing options for characters so I store all the clothes in a dictionary with relevant values describing them and then a load function to the PNG file for that specific clothing item. However, I'm new to game development so I'm not all that aware of best practices for situations like mine. Regardless, I appreciate the time you spent making these informative videos, keep up the good work!
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
I prefer json because I can easily pull them out of Google Sheets. With all my items in Google sheets balancing is a lot easier. Imagine I have a game with 80 different melee weapons, and I want to add another one. How much damage do I give it? How much durability, what sword/axe names do I already have? In Google Sheet I can filter for weapon type, sort on various stats to quickly balance this new weapon with all exsisting weapons. This becomes extra obvious when you data consist of not just weapons, but all kinds of other items, hundreds of them.
@-GIGA-
@-GIGA- 3 жыл бұрын
@@GameDevelopmentCenter Thank you so much for replying. I believe I'll be using JSON soon in my game so your videos are really invaluable to me right now.
@rainsong77
@rainsong77 3 жыл бұрын
Resource files give you a gui editor inside the engine, with things like dropdowns, sliders, pickers, constrained ranges. You can also put setters/getters, _ready, and really any kind of logic (including inheritance) because they are classes. I would argue that for an rpg they are better than JSON. If I want to create, say, a weapon, I just do Create resource->Weapon, and I get a weapon editor where I don't have to worry about mistyping property names, or curly brackets. If I want to add a "elemental damage" field to my weapons, I just add it to the class, and all my resource files now have that field, without me having to manually edit every entry.
@WestlyLaFleur
@WestlyLaFleur Жыл бұрын
@@rainsong77 Is there a solid video tutorial somewhere demonstrating this sort of functionality in the engine?
@avequenta5633
@avequenta5633 3 жыл бұрын
Love your videos!
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Glad you like them AVEQUENTA!
@BdyPhrk
@BdyPhrk 3 жыл бұрын
If I buy the assets you used from Unity asset store can I use them in Godot for commercial use?
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Yeah, Unity end user license agreement states that assets may be used to make (commercial) applications, like games. It does not state it has to be made with the Unity Game Engine (safe to use with Godot). And the license includes the use for commercial purpose, check the FAQ and EULA for more details (linked on the right hand-side of the unity store page (desktop) under the price.
@BdyPhrk
@BdyPhrk 3 жыл бұрын
@@GameDevelopmentCenter Thank you!
@olexayko
@olexayko Жыл бұрын
By calling set_drag_preview, i get error "E 0:00:00.436 set_drag_preview: Condition "!get_viewport()->gui_is_dragging()" is true." and can't figure out this. What is my error?)
@dantescanline
@dantescanline 3 жыл бұрын
hey this is a great tutorial!!
@spielville5087
@spielville5087 Жыл бұрын
Just wanted to confirm it is working or Godot 4.Rc1 as of now with little (if any) changes in the code. A few quick questions though: 1) How can we hide the "can't drop icon"; 2) How can we implement duplicate equipment slots (e.g. multiple rings)?
@fruitdudetv
@fruitdudetv 3 жыл бұрын
i am stuck at 17:20 - when i try to drag an equipment to my inventory it gives me following error messeag "Invalid get index 'InventorySlot' (on base: 'Dictionary'). im clueless where my error is because im pretty sure my code is excactly like yours.
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
I will need a screenshot of the code to help you. You can provide it on the Discord server.
@jocamar15
@jocamar15 3 жыл бұрын
Can't you merge both scripts together, while allowing one of them to be extensible, by using inheritance? Putting the common functionality in a base ItemSlot node and extending inheriting both other nodes from that one?
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
You could, that's actually how I started out when prepping for the tutorial. When I was finished I could only conclude it made the code needlessly complex.
@JBS512
@JBS512 3 жыл бұрын
Everytime I drag an item to an equipment empty slot it duplicates an invisible item in the place of the inventory origin item. I may have missed it somewhere but how do you get equipment_data in PlayerData to show up in equipment when you open the character sheet? When I print(data["target_item_id"]) it says null for empty spaces in the inventory, but it says 10002 or something when I drag it to an empty slot. I've been trying to figure this out for hours. Any help would be appreciated.
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Hi Jon, this will probably go faster if I can see your code. If you could join the Discord and send a screenshot (or multiple if needed), that would be great :)
@gamedev_byhobby8872
@gamedev_byhobby8872 3 жыл бұрын
I'm following with a bit of a different structure UI-wise but I'm having an odd problem where I can swap items and place the on the equipment and all but I can't place items on regular empty inventory slots. I'll rewatch and see if I did something wrong
@gamedev_byhobby8872
@gamedev_byhobby8872 3 жыл бұрын
Fixed! I missed a return true in can drop data
@plyczkowski
@plyczkowski 3 жыл бұрын
I'm guessing this functionality can't be used for dragging a Control node, with animations playing inside it, around?
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
I don't see a technical limitation to that. I think with some experimenting you should be able to get that to work.
@Gamedev00100
@Gamedev00100 3 жыл бұрын
thanks for this magnificent tutorial keep up the good work i love your channel. And i want to learn how to apply changing in equipment to reflect i n the player character for example if i equip new armor it will change the texture in the KinematicBody2d (player) to the new one.
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Thank you Karg! I got something for the equipment to show planned ;)
@Gamedev00100
@Gamedev00100 3 жыл бұрын
@@GameDevelopmentCenter good to read this from you thanks for the reply
@mrvladimir3795
@mrvladimir3795 3 жыл бұрын
Thx big for your work!
@mauriciodossantos9707
@mauriciodossantos9707 3 жыл бұрын
awesome!!!!!!
@agriasoaks6721
@agriasoaks6721 2 жыл бұрын
Can we make a logic in drop_data() if can_drop_data() returns false?
@GameDevelopmentCenter
@GameDevelopmentCenter 2 жыл бұрын
No, that wouldn't make sense as they are two separate code instances
@lkasikakalus123
@lkasikakalus123 3 жыл бұрын
nice
@adamdaniels1682
@adamdaniels1682 3 жыл бұрын
Anyone else get "invalid get index 'Rect' (on base: 'GDScriptNativeClass')." For var drag_texture = Texture.Rect.new() when they try to drag an item? The script is on the TextureRect node.
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
You have a dot in between Texture and Rect
@artyombeliy7569
@artyombeliy7569 Ай бұрын
For anyone else confused why dragging doesn't work in Godot 4, change the function names to include an underscore: _get_drag_data(_pos) _can_drop_data(_pos, data) _drop_data(_pos, data)
@jasper8598
@jasper8598 Ай бұрын
its still not working for me
@migueleduardo7895
@migueleduardo7895 3 жыл бұрын
I am having an error when transferring the item from the inventory to the inventory itself (I will not use a team inventory), what can it be?
@migueleduardo7895
@migueleduardo7895 3 жыл бұрын
The error is in line with "texture = data [" origin texture "]" Invalid get index 'origin_texture' (on base: 'Dictionary').
@migueleduardo7895
@migueleduardo7895 3 жыл бұрын
I mean, can you tell me which parts of the video are important for me to watch? (I will only use an inventory)
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
@@migueleduardo7895 seems like ypu never defined origin_texture. Share a screenshot of the code on Discord. Sure it is something that can be fixed in seconds :)
@yusarimahubara
@yusarimahubara Жыл бұрын
None of these tutorials deal with what happens if the preview is dropped somewhere outside the allowed field. It just disappears and you don't know how to get it back.
@GameDevelopmentCenter
@GameDevelopmentCenter Жыл бұрын
Not the goal of this tutorial. Several ways a developer may implement this depending on platform. This tutorial is about drag and drop inventory. Not about UI windows.
@ナルトうずまき-c9p
@ナルトうずまき-c9p 3 жыл бұрын
makes a crafting system
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Repeating the same message on multiple videos is not going to help you :)
@aliosha123
@aliosha123 3 жыл бұрын
the foam on the wall doesnt help you much coz i can hear the echo in the room like crazy...
Inventory Tooltip | Godot Inventory Tutorial
30:16
Game Development Center
Рет қаралды 13 М.
Grid Based Inventory System | Godot Inventory Tutorial
24:24
Game Development Center
Рет қаралды 40 М.
Try Not To Laugh 😅 the Best of BoxtoxTv 👌
00:18
boxtoxtv
Рет қаралды 7 МЛН
Yay, My Dad Is a Vending Machine! 🛍️😆 #funny #prank #comedy
00:17
Smooth Drag N Drop: Godot Guide
9:28
Bramwell
Рет қаралды 48 М.
Item Generation - Randomness and Rarity | Godot Tutorial
17:37
Game Development Center
Рет қаралды 11 М.
How To Drag And Drop In Godot - Basic Level Explanation
6:16
INVENTORY & ITEM SYSTEM in Godot
50:30
Code with Tom
Рет қаралды 56 М.
Godot Multiplayer Server-Client Tutorial | Godot Dedicated Server #1
41:20
Game Development Center
Рет қаралды 143 М.
Godot 4 - RPG Inventory System From Scratch
1:17:35
DevLogLogan
Рет қаралды 136 М.
Tierlisting the BEST (and worst) GAME ENGINES
33:51
BiteMe Games
Рет қаралды 235 М.