Resource Based Inventory - Godot 3.2 Intermediate Tutorial

Поділитися
Вставка
  • Опубліковано 23 вер 2020
  • Thanks for watching my video!
    Here is the source code (MIT License): github.com/uheartbeast/invent...
    If you are interested in taking a deeper dive into the Godot game engine you can buy my 1-bit Godot Course at this link: www.heartgamedev.com/1-bit-go...
    Check out my Patreon: / uheartbeast
    Follow me on Twitch for GameDev livestreams: / uheartbeast
    Twitter: / uheartbeast
    Facebook: / heartgamedev
    Thank you all so much for your support!
  • Навчання та стиль

КОМЕНТАРІ • 165

  • @uheartbeast
    @uheartbeast  3 роки тому +57

    Here is the source code (MIT License, download the images here): github.com/uheartbeast/inventory-tutorial
    I've got some plans for a new Godot series (similar to my GameMaker 2D Hack-n-slash series but not using the Grave resources).
    I'm still working through the details for that series but hopefully I can start making videos for it soon!
    Here is the link for the fall sale of my Godot course: www.heartgamedev.com/1-bit-godot-course-fall-sale
    Have a great weekend!
    - Ben

    • @stefans8885
      @stefans8885 3 роки тому +1

      You are the hero we need but don't deserve

    • @wiktorwektor123
      @wiktorwektor123 3 роки тому +1

      Good tutorial, but if your script doesn't need any code exept base class then why you never set proper option when crating new script? You should change "Template" from "Default" to "None" and save yourself deleting all this junk comments + _ready function. With template set to "None" every script has exactly one thing inside: "extend Base_Class_Name".

    • @boone_e
      @boone_e 3 роки тому

      When are you making another videos of the action rpg?

  • @mio-xh1ln
    @mio-xh1ln 10 місяців тому +26

    if you're using Godot 4.0, the code at 23:45 has new syntax. I got the error code invalid argument for "connect()" function and switched the code to the following:
    func _ready():
    inventory.connect("items_changed", Callable(self, "_on_items_changed"))
    update_inventory_display()
    which fixed the error :) happy coding everyone!!

    • @brandongroth4569
      @brandongroth4569 7 місяців тому +7

      Even easier syntax for 4.x: inventory.items_changed.connect( _on_items_changed)

  • @yonatankravitz8402
    @yonatankravitz8402 Рік тому +14

    In Godot 4 exporting is done with @export var name : String = ""
    @export var texture : Texture

  • @ChrisTutorialsYT
    @ChrisTutorialsYT 3 роки тому +28

    For the get_drag_data function, it seems to work better to use (var item = inventory.items[item_index]) instead of (var item = inventory.remove_item(item_index) because removing it before the drop means that if you move the item off screen, that it will disappear into the void. Testing with print(inventory.items) in drop_data it seems that the swap items already handles moving the data around so there's really no need to remove the item if it never gets to the drop_data function.

  • @r5LgxTbQ
    @r5LgxTbQ 2 роки тому +26

    19:10 the Vseparation and Hseparation are now in Theme Overrides -> Constants instead of Custom Constants. I'm using Godot 3.4.2

  • @アドチ
    @アドチ 3 роки тому +46

    sweeettt! have no need for a inventory but need something to manage custom decks in a card game

    • @USNTM2
      @USNTM2 3 роки тому +6

      Make a card resource and place the cards into an array.

  • @CraftingDiamond
    @CraftingDiamond 3 роки тому +21

    Im already seeing this video being one of the most useful godot tutorial you ever did. Custom Resources are really useful. Nice work!

  • @icefoxzettai
    @icefoxzettai 3 роки тому +14

    Not only i learned a good way to use Resources, but also how to make a simple UI inventory! Thanks a bunch!

  • @chicao.do.blender
    @chicao.do.blender Рік тому +2

    i'm glad i looked for your tutorial, i literally searched for "godot intermediate" so that i wouldn't get 10 videos of people repeating what is a node to my face and i'm glad i did it, i'm reading the documentation along with your video and you're ready to explain more than the tutorial requires, you're a great content creator

  • @slydogg9692
    @slydogg9692 3 роки тому +1

    Another great tutorial! I'm incredibly thankful for all the content and tutorials you've put out. I'm sure your content is, and will be, a springboard for many future games and gamedevs.
    Cheers to you and your efforts!

  • @nickcy5083
    @nickcy5083 3 роки тому

    Awesome, never tried to actually create an inventory system but Godot's workflow is surprisingly simple and intuitive, thanks for the vid!!

  • @greenapple4080
    @greenapple4080 3 роки тому

    Thanks for the video! Inventory is one of the things I had a hard time imagining how would work.

  • @AndrewCothill
    @AndrewCothill 3 роки тому +2

    20 seconds in and i'm already loving it!

  • @noxalas
    @noxalas 3 роки тому

    Thank you so much for this!
    There are a couple Godot tutorials on inventory I've seen, but either they don't fit what I need or they're a bit hard to understand. I really liked the way you used resources here rather than json, the solution is really neat and easy to understand. (Also really easy to expand upon) c:
    Would love to see more on inventory systems from you, since you always explain everything so well. Thank you again for another great tutorial.

  • @Baeso66
    @Baeso66 Рік тому

    This video was a great introduction to resources in Godot while implementing a nice inventory system. I feel like it opened a world of possibility for me.
    I already added healing potions that restore player's health when right-clicked from the inventory.

  • @StrawberryRaccoonNixie
    @StrawberryRaccoonNixie 7 місяців тому

    This was immensely helpful, thank you

  • @noahpen
    @noahpen 3 роки тому +4

    Amazing tutorial, just what i needed!

  • @anicepineapple9067
    @anicepineapple9067 3 роки тому +43

    I hope you realize you have saved me alone hundreds of hours on my life in my game development, not to mention everyone else who watches your videos.

    • @Yoni123
      @Yoni123 3 роки тому +1

      That's not even a finished inventory. Just like he didn't finish the APRG tutorial

    • @anicepineapple9067
      @anicepineapple9067 3 роки тому +6

      @@Yoni123 Well with a few simple additions I have turned it into one. So it works as a base.

    • @Joonysuke
      @Joonysuke 2 роки тому +7

      @@Yoni123 I'm a little late on this, but the thing you have to realize about tutorials is that they're not always going to be finished, or updated. Considering this is free content, this should be more than enough of a basis to get started. There are plenty of people about there who get stuck for days, weeks, months, maybe even years trying to wrap their head around starting programming systems like this. While others, it can only take moments after looking at the documentation and logic.
      Personally, I'd like to take the time at some point and try and dissect this video and its code to boil it down to be more readable and understandable for beginners, and brainlets(such as myself).

  • @RamonCavalcante
    @RamonCavalcante 3 роки тому

    I spent more than a month studying ways to make a simple inventory, yours is still better than what I got. I wish I had found this video before, hahaha. now i think i will redo it from scratch.

  • @whitedevil9262
    @whitedevil9262 3 роки тому +1

    Just what I was looking for from you! Thanks for the video :)

  • @himhim4150
    @himhim4150 3 роки тому +1

    I recently looked for a similar tutorial again, thank you very much!

  • @drunkard103
    @drunkard103 3 роки тому

    your videos are the clearest and easiest to understand godot tutorials i've come across. i know it's probably very basic stuff but i'd love to see a video on how to set animations correctly in 8 way movement and/or setting NPC movement paths
    thanks for all the great content ^_^

  • @trapshooter
    @trapshooter 3 роки тому +1

    I'm not even working on a game with an inventory system or even use godot (I use unity) but I still really enjoyed this video. I really like seeing how you organize and structure your code and it's also very calming. Great content man!

  • @wagnerrodrigues6440
    @wagnerrodrigues6440 3 роки тому +2

    Very nice tutorial, didn't know about the import presets for 2d pixel images! makes things much sharper!

  • @crashannburnFPV
    @crashannburnFPV 3 роки тому +1

    This is just what I need just when I need it! SO much easier than ue4! :D
    Thank you so much for making this tutorial!

  • @GamerReborn1979
    @GamerReborn1979 3 роки тому +3

    thank you this is really helpful, please make a follow up video about equipping items to a player from inventory i couldn't find any tutorial about that. keep up the good work :)

  • @sergeiorlov5096
    @sergeiorlov5096 3 роки тому

    I never needed such a system, or inventory in general, but now Ill have to start a new project around it.
    Well THANKS, Ben! xD

  • @anfi8673
    @anfi8673 3 роки тому +4

    wow, your tutorials are always interesting and useful

  • @DevDuck
    @DevDuck 3 роки тому +54

    Hey Ben! This is such a huge improvement to what I had, thanks for creating this series! Question about your `drop_data` implementation at 36:00 - calling `swap_items` and then `set_item` seems a bit unintuitive, since conceptually 'swap' should handle the movement of both items. It also results in our "items_changed" signal being fired twice in a row. Going to take a stab at refactoring on my end, but curious if you had any thoughts.

    • @uheartbeast
      @uheartbeast  3 роки тому +7

      Yeah, it is a bit strange. That is a good question. So the swap will swap the item in the target drop slot with the null that is in the slot we picked up our item from. Then we set the drop slot to have the item we are dragging. I guess I did it this way cause it skips a step.
      The alternative would be to get the item in the drop slot and set the slot we picked up our item from to be that item. Then set the drop slot to contain the item we are dragging. Hope that makes sense.

    • @RACOONLPs
      @RACOONLPs 3 роки тому +8

      @@uheartbeast thanks for the great the tutorial! I adapted your code to fit my use case.
      In ran over the same "problem" as @DevDuck and found the following solution: instead of removing the item when calling _get_drag_data( ) I set the item sprite to invisible. Later when dropping the data, I set it to visible again. That way when I call the swap method both items are still on there actual place and I don't to call set_item( ).
      I use this because it allows me to also prevent the user from dropping the item outside of the inventory. When the left mouse button is released I just make all invisible items visible again. If I would remove the item from the inventory and the player drops it outside the inventory I would loose the reference.

    • @wall_k
      @wall_k 3 роки тому

      @@RACOONLPs hey, I did almost the same! I didn't set it to invisible, I set texture to empty slot texture. And then swap_items method restored it all back to normal! Except when dropping outside the inventory, haven't found a good way to handle it yet ):

    • @RACOONLPs
      @RACOONLPs 3 роки тому +2

      @@wall_k If I remember it right, I have added a flag "dragged" to the item slot, that controls the visibility or the texture in your case. Whenever the player drags the item in the slot I set it to true and turn the item invisible. Then I check for a mousebutton released event. If the mouse button is released and dragged is true I set it to false an make it visible. Provided you swapped it with another slot the correct item (or none if only moved to an empty slot) should be visible. But if you draggeg it on an invalid space its still in the slot but invisible and you just have to set dragged to false and visible to true again.
      You could also implement logic that allows you to drop items on the map using the mousebutton released event.
      Hope that can help you. ;)

    • @wall_k
      @wall_k 3 роки тому +1

      @@RACOONLPs yeah, that makes sense, thank you!

  • @nincompoop17
    @nincompoop17 2 роки тому

    Brilliant! I learned so much!

  • @drbuni
    @drbuni 3 роки тому +8

    Thank you, Mr. Heartbeast. I always look forward to your Godot tutorials. The development of my game wouldn't be nowhere near as far without your help!

    • @uheartbeast
      @uheartbeast  3 роки тому +4

      You're welcome :) Feel free to send me screenshots or a trailer of your game when you feel ready to share it. I'd love to check it out.

    • @drbuni
      @drbuni 3 роки тому +1

      @@uheartbeast Thank you for offering me an opportunity to show my work! I will send you pictures of it soon!

    • @veselinborisov369
      @veselinborisov369 3 роки тому +1

      @@drbuni Wish you luck with your game, man! Don't forget to send a link for your game when you upload it.

    • @drbuni
      @drbuni 3 роки тому

      @@veselinborisov369 Thank you

  • @noid3571
    @noid3571 3 роки тому

    Just started with godot and you are one of the reasons I am able to speedrun the learning process. Thank you

    • @Mysterygamer420
      @Mysterygamer420 Рік тому +1

      So how did that speed run go? Been a year haha

    • @noid3571
      @noid3571 Рік тому +2

      @@Mysterygamer420 Made a pixel topdown multiplayer game about knights with MP5s in a randomly generated dungeon with endless waves. Took me about an hour to get used to shortcuts and stuff, about a week for GDscript and all different classes (like tf is an AStar). Few more days digging through networking documentation and tutorials and that's about it. I want to continue working on a new iteration with bosses and "tinykeep generation" but my whole year was consumed by college : (

  • @Rodoru
    @Rodoru 3 роки тому +2

    Hello, I’ve just started your course in Udemy. It’s super cool. Wish you the best.

  • @MrHaloisthebomb
    @MrHaloisthebomb 3 роки тому +2

    I'm going through your godot course right now and this is just one more thing to add to my toolbelt!

  • @nubunto
    @nubunto 3 роки тому +5

    This is so good! Thanks HeartBeast!
    I avoided having a to add a script to the InventoryContainer to "catch" data dropping outside of the InventorySlot by doing the following:
    instead of removing the item from the inventory inside get_drag_data, just get the item with inventory.items[item_index]
    then, on drop_data, you can do:
    func drop_data(_position, data):
    var item = data.get("item")
    var item_index = data.get("item_index")
    var my_index = get_index()
    inventory.swap_items(my_index, item_index)

    • @cyzaine
      @cyzaine 2 роки тому +1

      Underrated comment for sure. Less scripts to track the better!

    • @agriasoaks6721
      @agriasoaks6721 Рік тому

      How do we move items if we have different arrays?

  • @andresgrimminck8674
    @andresgrimminck8674 2 роки тому

    Great video!

  • @aartigupta7048
    @aartigupta7048 2 роки тому

    You are dope bro! Damn , thank you so much, subbed

  • @liampeterson8299
    @liampeterson8299 3 роки тому

    This is pretty cool, when i created an inventory, it was just a bunch of auto-generated panels and buttons

  • @MicahT
    @MicahT 3 місяці тому

    This video is really great and (with the help of a couple comments) wasn't hard to convert for Godot 4 (mostly adding the _ before _get_drag_data, etc.) but wanted to share something that took me hours to figure out. My items are a Sprite2D sprite sheet w/ 38 images and I tell it from the Resource what frame and hframe to use. But for the drag image, you can ONLY use a Control node, not a Sprite2D node. A TextureRect is a Control node, but you can't set hframes and use a sprite sheet and I really didn't want to individually export all 38 items just for the drag.
    I figured out the solution and it still took me a couple more hours to crack it, but here's the code if you want to get a Sprite2D to drag:
    var preview_texture = Sprite2D.new()
    preview_texture.texture = _drag_texture
    preview_texture.hframes = _drag_hframes
    preview_texture.frame = _drag_frame
    var preview = Control.new()
    preview.add_child(preview_texture)
    set_drag_preview(preview)
    I tried to just use my current sprite_2d.texture, etc. but I'm pretty sure that gets deleted right before the drag preview is made, so I had to add the _drag_texture etc. global variables and set those in the display_item(item) function. Works now and I'm relieved.
    Anyways, thanks Heartbeast.

  • @Parrexion
    @Parrexion 2 роки тому +1

    Man, I remember starting out in high school learning game maker 8 using an inventory tutorial.
    And now I'm back again but with Godot instead ^^

  • @Mysda_
    @Mysda_ 3 роки тому +1

    That moment you start to understand many new things even after having made some games

  • @LordJuz
    @LordJuz 3 роки тому

    the moment you called a function that didn't exist yet, I felt that

  • @RonDLite
    @RonDLite 2 роки тому

    I love how you are always concerned about the audio of the recording. Rest assure it is top notch.

  • @bitbutter
    @bitbutter 3 роки тому +1

    1:14 to anyone confused about what the height/width and test height/width settings are doing:
    height/width refers to *render* height and width.
    test height/width refers to *window* height and width.
    these properties will likely be given more fitting names in a future release of godot. more detail here: github.com/godotengine/godot/issues/16863

    • @halobread
      @halobread 3 роки тому

      so basically
      if not test is 1x1 and test is 2x2, it will be not test scaled to 2x2?
      am i right

  • @Dante3085
    @Dante3085 Рік тому +1

    13:50 The swap_items() implementation only requires 1 local variable, like so:
    var target_item= items[target_item_index]
    items[target_item_index] = items[item_index]
    items[item_index] = target_item
    emit_signal("items_changed", [item_index, target_item_index])

  • @BlackCat-gh8fr
    @BlackCat-gh8fr 3 роки тому

    Thank you! Great video.

  • @user-zd2qz8cx7s
    @user-zd2qz8cx7s 2 роки тому +1

    awesome

  • @goshinbi44
    @goshinbi44 3 роки тому +7

    if anyone is looking for how to have the dragged item be centered with your mouse cursor
    # set_drag_preview seems to put the top left corner where the mouse is
    # to fix this create a container, then add the texture as a child
    # then set it's rect position which is relative to parent
    var previewCon = Control.new()
    previewCon.add_child(dragPreview)
    dragPreview.texture = item.texture
    dragPreview.rect_position -= dragPreview.texture.get_size() * .5
    set_drag_preview(previewCon)

    • @tunicatetheawful606
      @tunicatetheawful606 2 роки тому +3

      You've proven that reading the youtube comments can be good after all. :)

    • @agriasoaks6721
      @agriasoaks6721 Рік тому

      If we have another container like chest or item bank, it means we'll make another array. How do we move items in that scenario?

    • @mrgreensuit7379
      @mrgreensuit7379 3 місяці тому +1

      in godot 4.0 rect_position is now just position or global_position so. "dragPreview.position -= dragPreview.texture.get_size() * .5"

  • @MrPoporucha
    @MrPoporucha 3 роки тому +2

    "Tall shields are the best shields"
    >SEETHES IN ROUND SHIELD

  • @lufog
    @lufog 11 місяців тому

    I believe it's better to handling unsuccessful drags in slot script:
    In _get_drag_data(...) instead of removing item, just hide the TextureRect. In _notification(...) handle NOTIFICATION_DRAG_END, check with is_drag_successful() if the drag was successful, if not show the TextureRect. And in _drop_data(...) remove item inventory.remove_item(data.index), when it is reliably known that the grag was successful.

  • @BrannoDev
    @BrannoDev 3 роки тому +1

    I found a pretty horrible way of 'fixing' the bug at the end. Just add a 2nd ColorRect above the Inventory Container on the tree, make it absolutely massive so you can't drag your mouse away from it and then attach the same script we added to the InventoryContainer. You will need to add a control node at the parent to everything though.
    It would be nice if there was a better way of resolving this but i don't even get information returned from any of the functions if it is dragged outside of the container.
    anyway thanks for the tutorial, I learned a lot.

  • @jazzy8391
    @jazzy8391 2 роки тому +4

    how do you add and remove items in the array for when you want to pick them up and remove them in the game (instead of dragging the .tres files into the array)?

  • @ethanspurrier7120
    @ethanspurrier7120 Місяць тому

    9:33 The array can be export with the following code @export var items : Array[Resources} = [ ]

  • @funky_pepe
    @funky_pepe 3 роки тому +7

    Here, \o/ have a hug u nice Internet person

  • @ss2cire
    @ss2cire 3 роки тому

    Very nice tut. Glad you posted it, but i take it this means the walker videos are done?

  • @user-lg7fz9bu2w
    @user-lg7fz9bu2w Рік тому

    Here's an unintuitive solution to the "dropping items" problem:
    dragPreview.tree_exiting.connect( _on_drag_end.bind(item) )
    This will cause the drag preview to call some function (_on_drag_end in my case) when it disappears, with the argument 'item'.
    The called function can make use of the 'is_drag_successful' function, which returns false if we dropped the item somewhere that could not accept its data:
    func _on_drag_end(item):
    if not is_drag_successful():
    inventory.set_item(get_index(), item)
    I feel like this solution is very clean as it does not require a new script and can be reused if we put the slot display somewhere else.

    • @agriasoaks6721
      @agriasoaks6721 Рік тому

      What if we have more than one containers to store items?

  • @severe2460
    @severe2460 3 роки тому

    A quick question: When setting the drag preview, I get an error:
    Invalid type in function 'set_drag_preview' in base 'CenterContainer (InventorySlotDisplay.gd)'. The Object-derived class of argument 1 (StreamTexture) is not a subclass of the expected argument class.
    Something I did wrong with the item resources and texture settings?

  • @hozerino
    @hozerino Рік тому

    If I want to store some "transient" info, like keeping a "condition" for a sword that is different between instances, how would the best way be?
    I'm losing myself when trying to store these infos while switching scenes like Inventory -> Dropped -> Inventory -> Equipped while still having the advantage of the resource inheritance... I tried having a ItemResource with a custom_properties = {} but didn't go well :c

  • @traceletz6786
    @traceletz6786 2 роки тому +1

    Ples ples ples make a new third video tutorial going more into this, I love how it look so much but after finishing the second video I'm still left confused on how to properly use the items and add it to my game.

  • @MrLexDog
    @MrLexDog Рік тому

    Can you tell me how to make the item selection function? So that you can left-click and the item is saved to a separate variable? I just want to implement descriptions and item interaction for my quest

  • @buterbrodxd7259
    @buterbrodxd7259 3 роки тому

    Hi HeartBeast, will this video be part of an episode or is it a standalone video without a sequel?

  • @mio-xh1ln
    @mio-xh1ln 10 місяців тому +2

    I'm using Godot 4.0.3 and it was working all the way until the get_drag_data() and the other two functions, turns out in Godot 4 the syntax is with an underscore at the start so get_drag_data() is now _get_drag_data()

  • @kushal8621
    @kushal8621 3 роки тому +1

    Hey friends
    Needed some help
    i want to move my character through area2d or any other node
    And I want to make my character appear double or more
    Like the game SKY by ketchapp

  • @caligox6320
    @caligox6320 Рік тому

    Most relatable tNice tutorialng ever

  • @TheAgentAPM
    @TheAgentAPM 3 роки тому

    How can I make the drag preview appear in a better spot? Like, the center of it being centered on the cursor. Because I don't like dragging the image by the top left corner.

    • @ZeroPlayerGame
      @ZeroPlayerGame 3 роки тому

      I have not tested this, but since it's a control you can set the preview texture rect_pivot_offset to be its rect_size / 2 and that should work.

  • @G69G71
    @G69G71 Рік тому

    this method works in 3.5? beacuse I loved so much this tutorial, I want to put a pause screen in this style.

  • @mattdavis3036
    @mattdavis3036 2 роки тому

    I'm having a strange offset issue, when I drag the item it appears far away from the mouse cursor, and when I move around (which moves the camera) the offset changes. I have a RemoteTransform2D, when I turn off "Use Global" the drag offset stays the same, but it is still far from the item. Anybody else notice this?

  • @1986Hikaru
    @1986Hikaru 3 роки тому

    I wonder who hard is to combine it with your old Mobile RPG project... And i really wanted something like a update and expansion of that tutorial, maybe with how put more character at same time or extra exploration elements.

  • @mlmattin
    @mlmattin 3 роки тому

    Very cool tutorial. I am new to Godot, but have done a lot of experimenting with Unity. Godot has caught my attention though. With regards to this inventory tutorial, how would this work with a save system? Obviously, if I save and quit then when I come back later I want the inventory to match what I saved. Would I just need to set all of those items in the Inventory resource at runtime when I load my save file? I'm thinking I would just save the index and resource path for each slot in the save file somehow. Anyway, some guidance on how you persist the inventory would be helpful.

    • @aerendyll
      @aerendyll Рік тому

      My guess is that you just need to make sure you save the array that holds all the items from inventory.tres.

  • @felineentity
    @felineentity 3 роки тому

    What did the preview part actually do? I think I missed that. Either way, great tut, can definitely use that! Didn't know the drag and drop was that simple.

    • @okyloky9432
      @okyloky9432 3 роки тому

      The preview is what adds the picture of the item near the mouse, otherwise you would drag just your mouse. It makes it easier to see what you're hovering over to drop your item in a new slot basically

  • @Elterapeuta_rd
    @Elterapeuta_rd 2 роки тому

    i love you ♥

  • @alanzulwas
    @alanzulwas 2 роки тому

    wow i never thought that resource can be save the array node.
    before i do it the same but i have to make one scene for save and load arrays data

  • @gnomemann6986
    @gnomemann6986 2 роки тому

    If i wanted to have multiple inventories or chests/other types of slots how would i go about adding those without getting index errors when moving between containers?

    • @agriasoaks6721
      @agriasoaks6721 Рік тому

      I'm getting just that exact error.
      Have you found any solution?
      Share it, please

  • @damian1722
    @damian1722 3 роки тому +1

    I'm having an issue with the InventoryDisplay.gd
    I can't run Inventory.tscn because of this error message:
    "Script inherits from native type 'GridContainer', so it can't be instanced in object of type: 'CenterContainer'",
    but then if I change the extends to CenterContainer I get an error saying the opposite:
    "Script inherits from native type 'CenterContainer', so it can't be instanced in object of type: 'GridContainer'"

  • @Yoni123
    @Yoni123 3 роки тому

    How to make this work with a gamepad instead of a mouse?

  • @usikstory
    @usikstory 3 роки тому

    when my swap the item changed but the icon not change.. whats wrong? i think the code work and similiar

  • @MassiveBreaker
    @MassiveBreaker Рік тому +1

    How would I use this with a hot bar or a crafting system? I am trying to figure it out, but it seems like I keep getting errors!

  • @ASimpleRobot
    @ASimpleRobot 3 роки тому +7

    can you pls make a video on item stacking? P.S. amazing video, was exactly what i was looking for

    • @uheartbeast
      @uheartbeast  3 роки тому +8

      I was actually planning on having that in this video but had to cut it because of time. I'll see what I can do about getting a second video with stacking in it :)

    • @ASimpleRobot
      @ASimpleRobot 3 роки тому +1

      @@uheartbeast thank you, cant wait :D

  • @anjanavabiswas8835
    @anjanavabiswas8835 3 роки тому

    thank you. the code is ... oddly very comprehendible. that was not the case with other tutorials i could find on youtube and thank god it takes care of swap.

  • @USNTM2
    @USNTM2 3 роки тому

    "Tall shields are the best shields". *REEEEEEE's in Tower Shield*

  • @takoyaki_1i
    @takoyaki_1i 3 роки тому +1

    If I wanted to add functionality to an item, would I have to create a new class that inherits from item and make it a resource? for example, if I wanted my potions to actually increase the players health, should I make a Potion class that inherits from Item, then create the resource and add it to the inventory?

  • @MrPoporucha
    @MrPoporucha 3 роки тому

    So, lets say I use this inventory and need to have equip slots in the same display...do I have to make ANOTHER inventory for the equipable slots? Same with item types: equipable, consumable, quest items, etc? If that the case, it will make my life perposterously easy :P

  • @bergglobus2428
    @bergglobus2428 3 роки тому

    12:04 filling an array with null kind of hurts because I know I will forget the null check at some point😂

  • @yapayzeka
    @yapayzeka 3 роки тому +1

    9:00 why cant we write we want a spesific type of resource like this:
    export (Array, Item) var items

    • @yapayzeka
      @yapayzeka 2 роки тому

      godot STILL doesn't support custom class export types T-T

  • @jellybon
    @jellybon Рік тому +1

    20:49 Make sure you drop in the actual .tres files and not the .png files here like I did 🤦

  • @thetiphon
    @thetiphon 6 місяців тому

    I dont see point of using swap_items function inside drop_data() because we dont actually swap anything. It's just more convoluted way to set_item inside inventory
    inventory.swap_items(my_item_index, data.item_index)
    inventory.set_item(my_item_index, data.item)
    ->
    inventory.set_item(data.item_index, my_item)
    inventory.set_item(my_item_index, data.item)
    works same

  • @pteale
    @pteale 3 роки тому

    Do you prefer Godot over Gamemaker?

  • @benjamin20149
    @benjamin20149 3 роки тому

    please make a followup

  • @faridrifai2166
    @faridrifai2166 3 роки тому

    Here i come again

  • @noahgaming2504
    @noahgaming2504 3 роки тому

    Can you make a farming video

  • @G69G71
    @G69G71 Рік тому

    this method works using keyboard instead of mouse?

  • @kaboomsihal1164
    @kaboomsihal1164 2 роки тому +1

    Items is one of those words that very quickly lose all meaning if you read it too often lol

  • @MegaGnads
    @MegaGnads 3 роки тому

    Wow. This comes out like a week after I finish working on an inventory system.
    Really like this video helps me see what I got right and wrong.
    The only thing I didn't like is that it uses drag and drop. Would have preferred it be click to pick up and then click to drop. I think most games have it like that instead of drag and drop. Right?

    • @vickylance
      @vickylance 3 роки тому

      most games uses drag and drop from what I have seen. Also that way its easier to port to mobile/touch devices

    • @MegaGnads
      @MegaGnads 2 роки тому

      @@vickylance I didn't think about mobile games. Agree drag and drop would be better in that context. I guess i was remembering old RPGs like Diablo... I think Stardew valley is also the same right?

  • @calumbeer4637
    @calumbeer4637 3 роки тому

    this sounds hard but could u find out how to make a crafting system

  • @astraldreamer331
    @astraldreamer331 3 роки тому +2

    Now if I actually had a clue how to use that in a game project?

  • @vickylance
    @vickylance Рік тому

    Hi Do you have separate day job for a living?

  • @surajsalian583
    @surajsalian583 3 роки тому +1

    Can you make Godot. Hack and slash game tutorial

  • @TheGiakaama
    @TheGiakaama 10 місяців тому

    This is interesting, but how can you use this in another system . EX: You have this inventory on your character, but also want to have another inventory on a chest. If you put the same thing on the chest even though you instantiate-it it as a new scene, when opening the " chest " inventory it's the same inventory because of the inventory.tres.
    From what I've tested you must have another scripts to handle that second inventory, and If you have less slots in the chest then again it's trouble because moving an item from index 3 in your character to index 0 in the chest inventory get's buggy .
    Wondering if someone tried this yet ? :)

  • @pwny4995
    @pwny4995 3 роки тому

    ITEMS!!!!

  • @sidned5768
    @sidned5768 2 роки тому

    can we see a tutorial implementing this into a game?