How to Make an Inventory System in Godot - (#1)

  Рет қаралды 127,765

Arkeve

Arkeve

Күн бұрын

Пікірлер: 219
@gumm
@gumm Жыл бұрын
There is another new difference in the tutorial for Godot4. When you are chaning the hotbar slot background based on whether or not it is occupied: You have to use "set('theme_override_styles/panel', style)" instead of "set('custom_styles/panel', style)"
@lauraqueen7848
@lauraqueen7848 Жыл бұрын
Ma hero
@Mrtargi
@Mrtargi Жыл бұрын
Man? you just saved me a lot of time.. thnx
@fangzahn
@fangzahn 7 ай бұрын
Thanks!
@poemyint4366
@poemyint4366 5 ай бұрын
for Godot 4: in inventory script it has to be @onready var inventory_slots in the ready function is inv_slot.gui_input.connect(slot_gui_input.bind(inv_slot)) in the for loop (inventory script) MOUSE_BUTTON_LEFT instead of BUTTON_LEFT instantiate() instead of instance set("theme_override_styles/panel") in the refresh_styles function
@tofidu
@tofidu 4 ай бұрын
THANK YOU
@Mikolaj_Kapusta
@Mikolaj_Kapusta 2 ай бұрын
So can Godot mess up my game in the future if I update the engine? Your code just stops working?
@tibetanfox376
@tibetanfox376 Ай бұрын
@@Mikolaj_Kapusta of course it can - that's dev life :D (never change a running system ;) )
@Mikolaj_Kapusta
@Mikolaj_Kapusta Ай бұрын
@@tibetanfox376 I'm sorry, I'm totally new to this and some obvious things sometimes still seem absurd. :D
@lumiscosity
@lumiscosity Жыл бұрын
in godot 4, .instance() is now .instantiate()
@theharddrug7566
@theharddrug7566 11 ай бұрын
Dude, with this simple line, you just saved my 3 days search on google
@darkhunter777
@darkhunter777 3 ай бұрын
write tutorial short =)
@Valgoskast
@Valgoskast 2 ай бұрын
I am using godot 4 and it says instanciate don't exist, KMP
@DharBluHIZ
@DharBluHIZ 2 ай бұрын
THX A LOTTT
@jaxterity
@jaxterity Ай бұрын
@@Valgoskast instantiate
@MrMutluOne
@MrMutluOne 4 жыл бұрын
I've watched several videos about Inventory sistem in godot, you came with simplest and easiest way, cant wait for ep2
@Arkeve
@Arkeve 4 жыл бұрын
Thanks!! That means a lot :)
@ReneSaarsoo
@ReneSaarsoo 2 жыл бұрын
Useful tutorial. One important point to note is that the order of calling remove_child() and add_child() matters. You can't have one node shared by several parents. So you need to make sure you always first remove a node from one parent before adding it to another. What I didn't like about the example code here was the direct accessing of the parent Inventory node from Slot nodes (and not only accessing, but modifying its state). It's like spooky action at distance - Inventory asks the Slot to do something, and the Slot ends up modifying the Inventory. I reorganized the code so that pickFromSlot() and putIntoSlot() only add/remove nodes from Slot, while the Inventory takes care of adding/removing its own nodes. I also found it more natural to have the pickFromSlot() return the item it removed.
@brenokaene1087
@brenokaene1087 Жыл бұрын
how did you make that?
@chipmunk718
@chipmunk718 Жыл бұрын
i refactored the code following this advice and it looks much better now, thanks
@AidenOcelot
@AidenOcelot 3 жыл бұрын
I like how in the first half you explained what you were doing and why. And then just gave up and showed finished code
@54nnu
@54nnu 4 жыл бұрын
>mfw an actual inventory tutorial that didn't fry my brain into an itty bitty raisin crisp thank you
@Arkeve
@Arkeve 4 жыл бұрын
Haha no problem! Im glad it was helpful :)
@NocturnalMorning
@NocturnalMorning 3 жыл бұрын
Great simple tutorial. For anyone following the tutorial. In the putIntoSlot function, don't forget the remove_child line. I spend half of my night figuring out why item.position = Vector2(0,0) was putting my items at the origin after moving them around slots, and that was the missing line. @Arkeve, not going to lie (and I've seen a few other comments about this), I have no idea why some of this works. A little explanation on things like why setting the position to (0,0) works for instance would really help noobs like myself understanding. Having said that, awesome tutorial, thanks for putting in the effort to make this whole series.
@user-gc8ee4kj7z
@user-gc8ee4kj7z 2 жыл бұрын
@@kyonas6047 Same lmao, did u fix it?
@benchampagne5266
@benchampagne5266 4 жыл бұрын
I don’t think you understand how long I’ve been searching for a tutorial that works EXACTLY like this. But it also explains the mouse filter. Thanks a lot. Can’t wait for the new ones!
@BetaTester704
@BetaTester704 4 жыл бұрын
same here, he truely is what we needed and wanted.
@Arkeve
@Arkeve 4 жыл бұрын
Glad its helpful!!
@aspiringwebdev1139
@aspiringwebdev1139 4 жыл бұрын
Even though the community made tutorials for godot are kind of lacking, it's good to see people starting to make more content. Hope we'll get to the level of unity in terms of content. That would be fantastic.
@sworcester1
@sworcester1 Жыл бұрын
Help for Godot 4, for those of you in the new engine: inventory slot signal connection: inv_slot.gui_input.connect(slot_gui_input.bind(inv_slot))
@lil-pingos7448
@lil-pingos7448 Жыл бұрын
TYSM I ALMOST DELETED ALL MY CODE AND STARTED A NEW TUTORIAL
@Secularis.
@Secularis. Жыл бұрын
do you know by any chance how to turn this code into a drag and drop inventory? place items on input.is_action_released I mean
@4dragons632
@4dragons632 Жыл бұрын
Thanks for this, I had a feeling it should look vaguely like that but I was fumbling around in the dark for half an hour trying different variations before I spotted this comment and it worked perfectly.
@comradechonky6328
@comradechonky6328 Жыл бұрын
Line 9:Identifier "slot_gui_input" not declared in the current scope. It gives me this error
@sworcester1
@sworcester1 Жыл бұрын
Not declared in current scope means the variable name is either incorrect, not referenced, or was never created. Check how/where that variable is created :)
@LoudSodaCaleb
@LoudSodaCaleb 3 жыл бұрын
Really good tutorial. But if I could make a sugestion, could you spend more time explaining the functions and their processes a bit more? It would more helpful for beginer/intermediate GDscript users who might not be that familar with what is exactly going on.
@froggyboo684
@froggyboo684 2 жыл бұрын
Yeeeeeeeeeeah
@ToastedGears
@ToastedGears 4 жыл бұрын
This is one of the best tutorials on how to make a basic inventory. Most tutorials stretch over 30 min and if you dont know any coding you dont want to see 30 mins of that
@hunterlepage
@hunterlepage 2 жыл бұрын
Actually yes you do want to see 30 minutes of that. You need to learn somehow and if the person is just copy and pasting a bunch of code you're learning nothing whatsoever which defeats the entire purpose
@Annmariekahn
@Annmariekahn 11 ай бұрын
for those getting the error: "attempt to call function add_child in base null" make sure you have the correct capitalization for the find_parent("Inventory") part. I named my node 'inventory' with a lowercase I and got the error above because I copied to code from the video with the capital I. as soon as I changed that to a lowercase I in both the pickFromSlot and putIntoSlot it worked and I no longer got that error.
@DinomaxProductions
@DinomaxProductions 9 ай бұрын
Thank you for this comment, I made the exact opposite mistake and couldn't figure out what was wrong
@thedevine3756
@thedevine3756 4 жыл бұрын
Quick, straight to the point, efficient. Good tutorial
@souvlaki42
@souvlaki42 2 жыл бұрын
very good tutorial bro but I have a problem. I'm following this in Godot 3.4 and when I run the project I got the 'Attempt to call function 'add_child' in base 'null instance' on a null instance.' error for inventoryNode. add_child(item) line in slot.gd. Can you help me?
@erengazioglu
@erengazioglu 3 жыл бұрын
GREAT tutorial! Tons of tiny revelations that're going to make _anyone's_ life easier. Cheers for good content!
@inhadar11
@inhadar11 Жыл бұрын
You are best, my friend. You saved me from write algorithm from scratch. Really good tutorial
@MarisaClardy
@MarisaClardy 4 жыл бұрын
Man, I have a huge amount of code to generate a grid of slots... I really should just be using containers... Nice vid. A lot more simplified than my implementation, which has already had 2 refactors and likely needs yet another after watching this. Hah.
@Arkeve
@Arkeve 4 жыл бұрын
Thanks! Well, I spend most my time refactoring old implementations so dont get to down about it. Good luck on your project!
@titans7455
@titans7455 4 жыл бұрын
Perfect timing to upload this I needed this
@Arkeve
@Arkeve 4 жыл бұрын
Glad I could help!
@titans7455
@titans7455 4 жыл бұрын
When’s part two
@titans7455
@titans7455 4 жыл бұрын
And can u make it so I can pick them up? In part 2
@ILoveWatchingTy
@ILoveWatchingTy 4 жыл бұрын
@@titans7455 yea like a adding system
@mio-xh1ln
@mio-xh1ln Жыл бұрын
I've been getting the following problem (Godot Ver. 3.5.1), it says "attempt to call function 'get_node' in base 'null instance' on a null instance". Turns out, I had the GridContainer as a node/ child of TextureRect. So: Inventory>TextureRect>GridContainer (meaning GridContainer is a grandchild of Inventory). It should be Inventory>TextureRect as well as Inventory>GridContainer. This solved the problem for me. I thought I'd mention it, since other people here in the comments seem to have the same problem. Happy coding to yall (:
@BartiqDnB
@BartiqDnB Жыл бұрын
So the last part worked for you? Kinda getting stuck in 4.0, tryin got connect the signal in the inventory _ready() function. Would love to know what the solution would be!
@EggMan6162
@EggMan6162 Жыл бұрын
​@@BartiqDnBsame problem
@faithfearless4656
@faithfearless4656 4 жыл бұрын
This, worth a subscribe from me. Can't wait for another one.
@Arkeve
@Arkeve 4 жыл бұрын
Thank you! Ill try to release the next one as soon as possible
@theravenpirate4744
@theravenpirate4744 3 жыл бұрын
Wow this has been super helpful with my game. Thank you so much!
@Arkeve
@Arkeve 3 жыл бұрын
Glad to hear it!
@theravenpirate4744
@theravenpirate4744 3 жыл бұрын
@@Arkeve for some reason I'm finding myself unable to click around the inventory in my game even though it works normally when I open up the inventory scene isolated. Any idea what might be causing the issue?
@Shadowthevampire
@Shadowthevampire 10 ай бұрын
Id suggest making an update version if this since people have said some things have changed since the update and people also wished for more rxplsnstion for beginners. I like this video do id be happy to see another version of it :)
@Omar-fu4jj
@Omar-fu4jj 3 жыл бұрын
i have an issue in line 38 in slots.gd it says : Invalid set index 'position' (on base: 'Nil') with value of type 'Vector2'.
@BrandonTheOverthinker
@BrandonTheOverthinker 3 ай бұрын
did you find a fix
@gilesaspin7083
@gilesaspin7083 3 жыл бұрын
Easy to follow and well explained, well done...
@mrsentixy8196
@mrsentixy8196 3 жыл бұрын
for anyone who is wondering if it works, it works just follow his instructions (Dec 15, 2020)
@nieli7695
@nieli7695 2 жыл бұрын
hi @Arkeve, in my opinion, this is the best tutorial for beginner that have zero coding knowledge like me.... ty ^^... but i wanna ask u something... how to change mouse button input into touch screen? for examples if we want to export it to android or ios...
@aspect3884
@aspect3884 Жыл бұрын
in project settings, input mapping
@maxwamsley
@maxwamsley 3 жыл бұрын
Holy sheet how does this guy not have more subs
@qloxhost
@qloxhost 3 жыл бұрын
I like the way you make tutorials I would like you to make a full functional game with tutorials :)
@qloxhost
@qloxhost 3 жыл бұрын
Is this a yes?
@goldengoblinX
@goldengoblinX 3 жыл бұрын
Dude, you are the best in this job
@kamos2216
@kamos2216 4 жыл бұрын
even after like 2 motns i found gold mine real big thanks
@shrippie-4214
@shrippie-4214 6 ай бұрын
Steve Worcester thanks : inv_slot.gui_input.connect(slot_gui_input.bind(inv_slot))
@petbij
@petbij 2 жыл бұрын
lovely tutorial. My thanks!
@MrSakfi
@MrSakfi 4 жыл бұрын
Nice job... Go on, Bro.
@andersstrom740
@andersstrom740 4 жыл бұрын
Thanks dude. u r the best!
@Arkeve
@Arkeve 4 жыл бұрын
:)
@theeternalwanderer3499
@theeternalwanderer3499 Жыл бұрын
thx this is a nice and clean tutorial
@KanishkaDilshan
@KanishkaDilshan 4 жыл бұрын
Looks great!
@hiddenascension3624
@hiddenascension3624 4 ай бұрын
this code has changed with godot update also from set("custom_styles/panel", default_style) to set("theme_override_styles/panel", default_style)
@aleksitjvladica.
@aleksitjvladica. 4 жыл бұрын
Exactly what I am looking for. I hope this works, other tutorials I checked did not provide the inventory system I would like to have. Edit: [08:10] What is "gui_input"?
@SILVERjavier
@SILVERjavier 2 жыл бұрын
gui_input(event: InputEvent)Emitted when the node receives an InputEvent.
@aleksitjvladica.
@aleksitjvladica. 2 жыл бұрын
Thank you.
@ILoveWatchingTy
@ILoveWatchingTy 4 жыл бұрын
I love the video but have one question Would it be bossible to intergrate like a description system like rarity type
@Arkeve
@Arkeve 4 жыл бұрын
Yeah ill go over adding item descriptions as well in future parts. You can see an example in my latest devlog
@ILoveWatchingTy
@ILoveWatchingTy 4 жыл бұрын
@@Arkeve Nice man keep it up i see a great future for you :)
@FrancoisSchnell
@FrancoisSchnell 4 жыл бұрын
Just discovered the channel with this video, cool! subed and keep it up! :)
@Arkeve
@Arkeve 4 жыл бұрын
Thanks for the support! :D
@nathanmasakadza4172
@nathanmasakadza4172 2 жыл бұрын
Great tuorial , but the only problem I am having is running get_global_mouse_position(), the engine is saying that the method isn't declared in the current class
@Bluelight82
@Bluelight82 3 жыл бұрын
Awesome tutorial for Godot! I love it! Is this inventory system safe against duplication of items? And can you expand on it to build a game where machines have an inventory and that one can interact with? Similar to a Furnace in Minecraft? Is it also possible to make a currency system? I such a n00b when it comes to coding! :-P
@ALEKSONEARTH
@ALEKSONEARTH 3 жыл бұрын
im fresh to godot so a noob question - say I had an RTS type of game and wanted to add inventory systems to all the characters, would I attach this node to the nodes for each character? (Ignore that this is probably not performant). Or is this more from the perspective of a World parent node, and one playable character uses it?
@Glacialan
@Glacialan 4 жыл бұрын
I love this!
@generic........
@generic........ 2 жыл бұрын
Random thing that shouldn't annoy me, but he says "Invent-ory" instead of the more common pronunciation : "Inven-tory" Anyway cool tutorial!
@rchannel1693
@rchannel1693 3 жыл бұрын
I love your videos!!! U are da best
@BronsoloTV
@BronsoloTV 3 жыл бұрын
Hey man, I followed the tutorial as closely as I could, but when I load up my inventory screen and click an item, the scene crashes and I get the error “ Attempt to call function ‘add_child” in base ‘null_instance” on a null instance’ “ in my Slot.gd script. I found a loophole by declaring “onready var inventoryNode = find_parent(“Inventory”)” at the top of my Slot.gd script and disabling the middle two lines in “func pickFromSlot” and “func putIntoSlot”, and it doesn’t crash, but I can’t actually drag my items around, only click them into different boxes. Is this a different issue? Any way to fix this? I’m pretty new to Godot so I’m not really sure what I’m doing yet.
@panicasherpanic6776
@panicasherpanic6776 2 жыл бұрын
no idea if you figured this out already, but I had the same issue for agggges and it turns out I had just capitalized "Inventory" when my actual node was lowercase ("inventory"). so if i understand correctly, it was calling a node that wasnt there and returning null, hence the "null instance" bit. maybe this helps?
@Stretox
@Stretox 2 жыл бұрын
@@panicasherpanic6776 You probably Misspelled Inventory wrong along the way. Also if you already Added your missspelled "Invnetory" Scene into another scene and changed the name afterwards to be correct it doesn't get updated.
@jvstAsYouAre
@jvstAsYouAre 4 жыл бұрын
I'm getting an error under the put_into_slot function at item.position = Vector2(0, 0), where it says "Invalid set Index 'position' (on base Nil) with value of type Vector2". When i open the inventory and click on an icon to pick it up my game crashes and I get this error. What could it mean?
@jvstAsYouAre
@jvstAsYouAre 4 жыл бұрын
I had literally forgotten if holding item != null under the slot_gui_input funtion. Leaving this here incase someone makes the same mistake
@nieli7695
@nieli7695 2 жыл бұрын
u are a life saver... ty so much... T.T
@GrowthforGames
@GrowthforGames 4 жыл бұрын
Great video!
@jazzy8391
@jazzy8391 3 жыл бұрын
After the ready function towards the end of the video in Inventory.gd, I keep getting an error at for inv_ slot. it says: Attempt to call function 'get_child' in base 'null instance' on a null instance.
@fernandobarbosa25
@fernandobarbosa25 3 жыл бұрын
I think it's get_children() instead.
@adabi8162
@adabi8162 2 ай бұрын
The same isn't working even with get children​@@fernandobarbosa25
@nyctimus6015
@nyctimus6015 4 жыл бұрын
hey can you explain a bit what is that you are doing for the default_style: StyleBoxTexture and the empty_style: StyleBoxTexture? cause those are variables you created but you arent assigning stuff to them i havent really seen the colon being used like that with variables before
@Arkeve
@Arkeve 4 жыл бұрын
The colon just specifies the type, it isnt necessary. I created the variables but i assign values to them in the ready function.
@jomarllamas7890
@jomarllamas7890 3 жыл бұрын
Can this be applied in 3d
@anjanavabiswas8835
@anjanavabiswas8835 3 жыл бұрын
Okay .. um i was facing an error with the get_global_mouse_position.. thing... so what i did was $"(name of node containing panel)".get_global_mouse_position() Edit: Clicking an item twice ... is breaking the inventory. :( I guess Ishould make another if to fix that?
@TheTheSusssu
@TheTheSusssu 4 жыл бұрын
Thank you for sharing!
@Arkeve
@Arkeve 4 жыл бұрын
Anytime ! :D
@TheRealKaiProton
@TheRealKaiProton 10 ай бұрын
3:15 why TextureRect and not Sprite ?
@shrippie-4214
@shrippie-4214 6 ай бұрын
I think its because TextureRect can get input
@Maxstate
@Maxstate 2 ай бұрын
My slots are too small for the items :( They aren't aligned properly (Godot 4)
@mrnowaatv1205
@mrnowaatv1205 4 жыл бұрын
i can't run the code! "Parser Error : The method "get_global_mouse_position" isn't declared in the current class." the code is the same as yours, as i get it into that video
@mrsentixy8196
@mrsentixy8196 3 жыл бұрын
same, idk why
@mrapexpredator904
@mrapexpredator904 10 ай бұрын
great tutorial man but im having this issue where the item scene is loading under the slot after i move it with the mouse if i could get a tip
@dirkkruger1934
@dirkkruger1934 2 жыл бұрын
as some one who has absolutely no coding experience. I am going to attempt to modify this so I can use it to code a quest journal instead. LMFAO
@bnkm07
@bnkm07 2 жыл бұрын
before i start watching the whole playlist i wanna ask if this works in 3d?
@GorblinRat
@GorblinRat 2 жыл бұрын
I am recieving this error, any idea how to solve this? thanks? E 0:00:31.433 emit_signal: Error calling method from signal 'gui_input': 'Node2D(Inventory.gd)::slot_gui_input': Method not found..
@fye5602
@fye5602 3 жыл бұрын
I need a little bit help. If i start my game, the debugger shows me following: Invalid get index 'Slime Potion' (on base: 'Dictionary') on item.gd. Sometimes it's Iron Sword, sometimes Tree Branch. Any ideas? Second Failure: Same as first, but on Slot.gd on the "add_child(item)" line straight after "if randi() % 2 == 0: item = ItemClass.instance()"
@connorjade5460
@connorjade5460 8 ай бұрын
when will u update the videos for godot 4??
@Secularis.
@Secularis. Жыл бұрын
hello, I've tried re-writing the slot_gui_input function so that pick-up is performed when clicking but put-in-slot functions happen when releasing the input, I just can't make it work for the life of me, it just returns the item to the original slot. Picking up works perfectly fine
@Yoni123
@Yoni123 3 жыл бұрын
How about using a gsmepad instead of a mouse?
@slinky9216
@slinky9216 Жыл бұрын
The project does not work it says Line 10:Identifier "File" not declared in the current scope. Line 12:Identifier "File" not declared in the current scope.
@Della_B
@Della_B 2 жыл бұрын
I've follow step by step, but i can't swap the items. It won't move 🤔
@michaelbennaim9463
@michaelbennaim9463 3 жыл бұрын
Hey, I found the tutorial great and very clear, but my program doesn’t work and I can’t for the life of me figure out why. The icons appear correctly but as soon as I click on one of them it disappears, then I can’t do anything anymore. Do you maybe know what’s that related to, thx in advance.
@Dianruakrhakakks
@Dianruakrhakakks Жыл бұрын
how to resize the images? your code works but the images appear too big not scaled to the grid slots
@jongeorge3358
@jongeorge3358 4 ай бұрын
Im having this problem too
@noahgranger6749
@noahgranger6749 3 жыл бұрын
Will this tutorial still work in 3d?
@Thisisdcode
@Thisisdcode 4 ай бұрын
so i have this disorder where my code doesen't work when i type it but when copy pasting it it just works and it left me with a wtf moment. any relatables?
@PhucHuynh-u7m1k
@PhucHuynh-u7m1k 4 ай бұрын
Thank a ton!
@ragnarhagberg6716
@ragnarhagberg6716 3 жыл бұрын
This does not work for me when exported to windows. I think my code cannot access the JSON file
@darkhunter777
@darkhunter777 3 ай бұрын
Стили и закраски ячеек, не обязательно было в туториал запихивать 😁
@ClassicMushroom
@ClassicMushroom 3 жыл бұрын
Hey so I am using your tutorial and everything is working except for the fact that my sprites are huge in the inventory, blocking it up entirely.
@jnju5112
@jnju5112 3 жыл бұрын
This is a late reply but try adjusting the scale setting of the sprites. I think it has to do with your sprites being hypothetically 64x64 while the inventory slot is 32x32
@solicity1785
@solicity1785 4 жыл бұрын
great tutorial really easy to get along to but i feel like its kinda inefficient to preload the item can adding a button to the item scene and set one var into an array of the panels and for loop checking of all of them is null then if it isnt then when on click event happens you just code in the variable to set the preload into the item that was clicked on or is this less efficient and impossible anywaays great vid hope you make more
@Arkeve
@Arkeve 4 жыл бұрын
Yeah you maybe right, I wasn't focusing too much on performance with these tutorials, you can definitely try to modify it to how you like for a better performing system!
@solicity1785
@solicity1785 4 жыл бұрын
@@Arkeve nah im probably not right as i tried it and not 1 bit of my idea works on godot atleast but great videos man hope you grow more subs!!
@Yukaraoke
@Yukaraoke 3 жыл бұрын
Iv been working for days on my inventory in unity. I also have a way to save my player data. Was wondering if it would be worth it or if its easier to transfer my progress to godot with all these available tutorials now.
@Arkeve
@Arkeve 3 жыл бұрын
I haven't tried Unity so I can't give you any sound advice. But maybe try out Godot and see how you like it first before switching.
@Yukaraoke
@Yukaraoke 3 жыл бұрын
I've started using Godot now and I'm following your tutorials. Thanks a lot for this. You deserve all support 💕
@Yukaraoke
@Yukaraoke 3 жыл бұрын
I've started using Godot now and I'm following your tutorials. Thanks a lot for this. You deserve all support 💕
@agriasoaks6721
@agriasoaks6721 3 жыл бұрын
Sir, why can't I move my item? Do you know what the problem might be?
@Sheol_Society
@Sheol_Society 5 ай бұрын
In the Inventory script change line 27 & 31 to holding_item.global_position = event.global_position this worked for me.
@Raformatico
@Raformatico 4 жыл бұрын
Great tut, thank you and cheers! 👏 +1 Subs
@Arkeve
@Arkeve 4 жыл бұрын
Thank you! Glad you found it helpful :D
@hamzailer
@hamzailer 4 жыл бұрын
omg tysm when is the next one coming out
@Arkeve
@Arkeve 4 жыл бұрын
Within the next few days
@hamzailer
@hamzailer 4 жыл бұрын
@@Arkeve ill be waiting :D
@geckokun2805
@geckokun2805 3 жыл бұрын
Cool!
@JMXBEATS
@JMXBEATS 3 жыл бұрын
I had a problem where in pickFromSlot it said I was attempting to add a child in a null instance on a null instance
@millioncats5790
@millioncats5790 3 жыл бұрын
I have the same problem, I think it's having trouble finding the "Inventory" node but showing it the path didn't work for me
@samuelkelly5061
@samuelkelly5061 3 жыл бұрын
Hey can someone please help in my inventory script says that it cant call the method "gui_input"
@potat1658
@potat1658 4 жыл бұрын
Is there a difference between a node and a node 2d?
@Arkeve
@Arkeve 4 жыл бұрын
Node2D is usually used for 2d games and Node is used for 3D
@definitelymdt
@definitelymdt 2 жыл бұрын
Does this work for Android too?
@markwakin490
@markwakin490 4 жыл бұрын
What size is ur window?
@Arkeve
@Arkeve 4 жыл бұрын
480 by 270
@hunterlepage
@hunterlepage 2 жыл бұрын
would've been a good tutorial if you didn't copy and paste everything and actually explained them instead
@n3rf591
@n3rf591 3 жыл бұрын
When I put in the code I can get the randomized items but it never lets me move them I keep checking I tried copying and pasting from the one thats in the zip file but it gives me an error and when I type it out it doesn't even do anything and gives me errors I dont know how to fix
@shrippie-4214
@shrippie-4214 2 жыл бұрын
same you figure it out yet i tried printing something when i click the mouse button and it doesn't even sense the input
@Della_B
@Della_B 2 жыл бұрын
Same, it happen to me too. I've try to add and set an Input Map "BUTTON_LEFT", yet it still didn't work :/
@msamil679
@msamil679 3 жыл бұрын
Amazing but i would like to ask that how can i add more than 2 items in 6 slots.I hope u will help me.
@youbadassXneb
@youbadassXneb 3 жыл бұрын
i have exactly copied your "Item" code and i get this error Script inherits from native type 'Node2D', so it can't be instanced in object of type: 'Panel' why is this? EDIT: The erro was because i am an idiot. It was because i chose the "Item" script for my panels.
@dipievil
@dipievil 3 жыл бұрын
Dude.... You just saved aonther idiot here! Thanks
@micka394
@micka394 3 жыл бұрын
i got the error Nonexistent function instance in base GDscript can anyone pls help
@ClassicMushroom
@ClassicMushroom 3 жыл бұрын
You have to show your code if you want help
@micka394
@micka394 3 жыл бұрын
@@ClassicMushroom thanks for the help but i deleted the script already
@ArtembAartemb
@ArtembAartemb 3 жыл бұрын
Hi, great tutorial, thank you! I was trying to make it similar to yours, but so that you don't click to pickup then click to drop, but you drag and drop. The problem I found is that the mouse release event triggers on the same panel on which you pressed it, but not the panel you have your mouse on when releasing, Bloody annoying. Does anyone know of any workaround for that? Thanks
@gersongerson2481
@gersongerson2481 3 жыл бұрын
just when you release the mouse a InputEventMouseMotion event appear (for the other panel), so you should can check if the last event was a left click release, there is my code: var last_event : InputEvent = null var last_slot : SLOT_CLASS = null func slot_gui_input(event : InputEvent, slot : SLOT_CLASS): if event is InputEventMouseButton: if event.button_index == BUTTON_LEFT && event.pressed == true: if holding_item != null: #On Put OnPutItem(event, slot) elif slot.item: # On Pick OnPickItem(slot) last_event = event last_slot = slot # On release elif event is InputEventMouseMotion: if last_event != null: if last_event.button_index == BUTTON_LEFT && last_event.pressed == false: if holding_item != null: OnPutItem(event, slot, last_slot) func OnPutItem(event : InputEvent, slot : SLOT_CLASS, slot2 : SLOT_CLASS = null): if !slot.item: #Put on empty slot slot.PutIntoSlot(holding_item) elif slot.item and slot2 != null: # Swap items slots var temp_item = slot.item slot.RemoveItem() slot.PutIntoSlot(holding_item) slot2.PutIntoSlot(temp_item) #slot2 is a empty slot before OnPickItem holding_item = null
@agriasoaks6721
@agriasoaks6721 3 жыл бұрын
@@gersongerson2481 what is this "item" in the code of the inventory?
@gersongerson2481
@gersongerson2481 3 жыл бұрын
@@agriasoaks6721 The item is the object that slot hold.
@agriasoaks6721
@agriasoaks6721 3 жыл бұрын
@@gersongerson2481 In my design, I combine the panel(slot) and the texture rect(item). In result, I can't move the item. How can we fix it?
@gersongerson2481
@gersongerson2481 3 жыл бұрын
​@@agriasoaks6721 the item should be a Node2D (not a texture rect) because it has a global_position property. Try to do exactly the tutorial so that you understand the solution.
@isaac8228
@isaac8228 3 жыл бұрын
Everything works well but I couldn't drag the item. I can only swap them around but I can't move them. Does anyone know how to fix this?
@isaac8228
@isaac8228 3 жыл бұрын
it was the "func input():" remember to make it "func _input():"
@Paulos777
@Paulos777 3 жыл бұрын
7:30 how did we come up with item = new_item ? when I type that in, I get and error (The identifier "new_item isn't declared in the current scope. Anyone else with that problem?
@lightbreathermusic
@lightbreathermusic 3 жыл бұрын
the function must be defined as func putIntoSlot(new_item): what this does is it defines a function and a local variable
@ernst1183
@ernst1183 2 жыл бұрын
Hi! I'm a beginner and I'm studying these scripts to improve my "syntax". There's a particular line i I'm struggling with. It's the 15th line in the inventory.gd script: If !slot.item: I didn't know you could use "!" in that way. So far I had only used it in the "!=" expression. Could anyone explain to me what is that line really "saying" and where could i find more information about that usage of "!"? I've tried with the official documentation with no luck.
@v84l42
@v84l42 2 жыл бұрын
if !slot.item: means if slot item is false if (slot.item): means if slot item is true
@ernst1183
@ernst1183 2 жыл бұрын
@@v84l42 Ok! Thanks for your answer!
@mathislalonde353
@mathislalonde353 9 ай бұрын
still working ?
@oOoSairenoOo
@oOoSairenoOo 8 ай бұрын
Yes, in 4.2 Godot, but u need to do some changes
@juiceman7649
@juiceman7649 3 жыл бұрын
Buy PYTHON crash course book to all you first time coders really gives thorough context to all the online tutorials you'll go through.
@Mastercar77
@Mastercar77 2 жыл бұрын
I'm facing an issue where Control::gui_input(event:InputEvent) is not working. It just doesn't recognize the mouse input. The signal has been correctly connected (checked with: slots[i].is_connected("gui_input", self, "_slot_gui_input")) but the _slot_gui_input function is not being triggered. :(
@v84l42
@v84l42 2 жыл бұрын
use inv_slot.connect("gui_input", slot_gui_input, [inv_slot])
The Most Impressive Scratch Projects
11:00
DenshiVideo
Рет қаралды 5 МЛН
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 22 МЛН
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 63 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,8 МЛН
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 356 М.
Learning C++ by making a Game... in 1 Week?!
10:14
Floky
Рет қаралды 546 М.
Making a Game in Python with No Experience
5:57
Goodgis
Рет қаралды 1,7 МЛН
PirateSoftware Breaks Down CrowdStrike Computer Issue
12:56
itmeJP Shorts
Рет қаралды 213 М.
How To Make A Game Alone
8:11
Thomas Brush
Рет қаралды 1,1 МЛН
I Made a 32-bit Computer Inside Terraria
15:26
From Scratch
Рет қаралды 3,9 МЛН
How to Add Interaction in Godot 4
16:48
Nagi
Рет қаралды 19 М.