Stackable Items | Godot Inventory Tutorial

  Рет қаралды 4,755

Game Development Center

Game Development Center

Күн бұрын

Пікірлер: 26
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Regretfully I did not take into account one situation in which an item is dragged on top of itself. This result in items disappearing from the inventory. I address this in the next tutorial at the specific timestamp included in this link: kzbin.info/www/bejne/l3XTqIWQoM2Hq5o
@darkhunter777
@darkhunter777 Ай бұрын
Мущина, исправь ошибку в моём коде plzz, я выложил исходник на cyberforum. Там проблема с удалением итема, при перетаскивании в ячейку для треша картинка пропадает, а реальный элемент не удаляется. Drag and drop я нормально прописал
@HarbingerSh
@HarbingerSh 2 жыл бұрын
if you want to add a limit to a specific item all you have to do is to add a stack limit to the item data in your database 0:35 first in your inventory slot script in the get_drag_data function you need also to define a new data value 4:18 instead of adding 2 more lines now we need also one more data['origin_stack_limit'] = GameData.item_data[str(PlayerData.inv_data[inv_slot]['Item'])]['Stacklimit'] ---> "Stacklimit" is what I called it in my database 0:35 feel free to change it then you can add this if statement to your inventory slot script after we calculate the new stack amount line 88 11:15 if newStack > data['origin_stack_limit']: var split = newStack - data['origin_stack_limit'] newStack = newStack - split data['origin_node'].texture = texture PlayerData.inv_data[origin_slot]['Item'] = data['origin_item_id'] PlayerData.inv_data[originSlot]['Stack'] = split if split > 1: data['origin_node'].get_node('../Stack').set_text(str(split)) do not delete anything from the video just add this statement to line 88 after you calculate the new stack amount
@IkaNine
@IkaNine Жыл бұрын
Thank you very much for this brilliant series of tutorials
@hermez2646
@hermez2646 3 жыл бұрын
Thank you for your tutorials, they are AWESOME! And Congrats to 10k Subscribers!!!
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Glad you like them! And yes, the 10k milestone. Still need some time to process that :)
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
I will also include an episode after the splitting-stacks tutorial to make use of the inventory SFX from the 80% discounted pack that is on GameDevMarket during the month March. Check it out if you haven't already. It has over 2000 SFX and a lot of them are very useful for multiple projects. www.gamedevmarket.net/asset/featured-creator-bundle-potionaudio/?ally=tkznLbwI
@mrvladimir3795
@mrvladimir3795 3 жыл бұрын
Thank you for your work. I look your tutorial and write inventory plugin for Godot on github ;)
@USNTM2
@USNTM2 3 жыл бұрын
I want to say that I am continuing to support you and plug you every chance I get, GDC! Love your work. I have a question about design decisions: Why have a column that is "Stackable" as a boolean? Why not use the "MaxStackSize" column as go-to column and anything you don't want to stack, have set to a value of "1"?
@USNTM2
@USNTM2 3 жыл бұрын
I saw the answer below. Please ignore this question, GDC! I love your work.
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Thx Kevin, that is awesome to hear and thank you so much for spreading word :) It will definitely help reach more people and in turn help them to express their creativity :)
@chushkatapiperkov749
@chushkatapiperkov749 3 жыл бұрын
thank you my guru
@Jonislaus
@Jonislaus 3 жыл бұрын
But what if I am one of those unscrupulous devs and want to make projectiles, like arrows, as a limited stackable equipment. Should I just make a special script for that one slot that allows stacking and moving items from inventory?
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Change the logic to accomodate. With the code from the inventory slot and the code of the equipmentslot it shouldn't be hard to come up with the lines you need to accommodate arrows/ammo. :)
@Jonislaus
@Jonislaus 3 жыл бұрын
@@GameDevelopmentCenter Yea, I sort of found a way, just need to make it work so that it doesn't screw the rest of the functionality. Cheers!
@NarZeL7
@NarZeL7 3 жыл бұрын
Thank you so much
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
My pleasure :)
@1ncrement
@1ncrement 2 жыл бұрын
holy shit that cool, tnx u rly
@ZephraMonocure
@ZephraMonocure Жыл бұрын
I know this is an outdated tutorial, but how would you go about "hiding" the origin slot while moving the item around? Similar to how Runescape does their item dragging. I'm able to hide it with this code... var default_texture = null data["origin_node"].texture = default_texture data["origin_node"].get_node("../MC/Stack").set_text("") ...placed after the set_drag_preview, but im not sure how to bring it back when you drag somewhere that isnt handled by the can_drop_data function.
@GameDevelopmentCenter
@GameDevelopmentCenter Жыл бұрын
You have the origin node, with that you should be able to retrieve the data that you haven't set to null or switched yet. That should be enough to drop the item back in (visually)
@ZephraMonocure
@ZephraMonocure Жыл бұрын
@@GameDevelopmentCenter Thank you! I have that working for the drop_data condition for when you drag to the origin node ie self, but im not sure how to do it for when you drop outside the inventory or equipment slots.
@GameDevelopmentCenter
@GameDevelopmentCenter Жыл бұрын
Please join Discord, I don't have enough context with these type of snippets.
@ZephraMonocure
@ZephraMonocure Жыл бұрын
Sure thing!@@GameDevelopmentCenter
@mars3142
@mars3142 3 жыл бұрын
A pro feature would be not stackable equals true/false. It should be a number between 1 and infinity, to show what the max stack limit should be ;)
@GameDevelopmentCenter
@GameDevelopmentCenter 3 жыл бұрын
Yeah, that would only require minimal change in code and it would add that little extra touch, great idea!
@VortexArtLab
@VortexArtLab 3 жыл бұрын
Спасибо большое)
Split Inventory Stacks | Godot Inventory Tutorial
19:38
Game Development Center
Рет қаралды 2,8 М.
I Paid Fiverr Game Developers to Make the Same Game
10:25
BadGameDev
Рет қаралды 690 М.
отомстил?
00:56
История одного вокалиста
Рет қаралды 4,5 МЛН
Whoa
01:00
Justin Flom
Рет қаралды 60 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 53 МЛН
How to Make an Experience Bar in Godot 3.2
21:45
Game Development Center
Рет қаралды 6 М.
4 Godot 4 Devs Make 4 Games in 44 Hours
25:19
DevLogLogan
Рет қаралды 519 М.
Using Composition to Make More Scalable Games in Godot
10:13
Firebelley Games
Рет қаралды 227 М.
Item Generation - Magical Properties | Godot Tutorial
23:03
Game Development Center
Рет қаралды 3,8 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,1 МЛН
I Made Minecraft in Godot
28:36
RachelfTech
Рет қаралды 36 М.
My Experience Moving to Godot from Unity
16:54
DarkDax
Рет қаралды 22 М.
How do non-euclidean games work? | Bitwise
14:19
DigiDigger
Рет қаралды 2,4 МЛН
Why I’m switching from Unity to Unreal Engine
9:02
LixianTV
Рет қаралды 1,1 МЛН
We made Vampire Survivors BUT in 10 Lines of Code
7:08
PlayWithFurcifer
Рет қаралды 1 МЛН
отомстил?
00:56
История одного вокалиста
Рет қаралды 4,5 МЛН