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 Жыл бұрын
Ma hero
@Mrtargi Жыл бұрын
Man? you just saved me a lot of time.. thnx
@fangzahn7 ай бұрын
Thanks!
@poemyint43665 ай бұрын
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
@tofidu4 ай бұрын
THANK YOU
@Mikolaj_Kapusta2 ай бұрын
So can Godot mess up my game in the future if I update the engine? Your code just stops working?
@tibetanfox376Ай бұрын
@@Mikolaj_Kapusta of course it can - that's dev life :D (never change a running system ;) )
@Mikolaj_KapustaАй бұрын
@@tibetanfox376 I'm sorry, I'm totally new to this and some obvious things sometimes still seem absurd. :D
@lumiscosity Жыл бұрын
in godot 4, .instance() is now .instantiate()
@theharddrug756611 ай бұрын
Dude, with this simple line, you just saved my 3 days search on google
@darkhunter7773 ай бұрын
write tutorial short =)
@Valgoskast2 ай бұрын
I am using godot 4 and it says instanciate don't exist, KMP
@DharBluHIZ2 ай бұрын
THX A LOTTT
@jaxterityАй бұрын
@@Valgoskast instantiate
@MrMutluOne4 жыл бұрын
I've watched several videos about Inventory sistem in godot, you came with simplest and easiest way, cant wait for ep2
@Arkeve4 жыл бұрын
Thanks!! That means a lot :)
@ReneSaarsoo2 жыл бұрын
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 Жыл бұрын
how did you make that?
@chipmunk718 Жыл бұрын
i refactored the code following this advice and it looks much better now, thanks
@AidenOcelot3 жыл бұрын
I like how in the first half you explained what you were doing and why. And then just gave up and showed finished code
@54nnu4 жыл бұрын
>mfw an actual inventory tutorial that didn't fry my brain into an itty bitty raisin crisp thank you
@Arkeve4 жыл бұрын
Haha no problem! Im glad it was helpful :)
@NocturnalMorning3 жыл бұрын
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-gc8ee4kj7z2 жыл бұрын
@@kyonas6047 Same lmao, did u fix it?
@benchampagne52664 жыл бұрын
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!
@BetaTester7044 жыл бұрын
same here, he truely is what we needed and wanted.
@Arkeve4 жыл бұрын
Glad its helpful!!
@aspiringwebdev11394 жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
TYSM I ALMOST DELETED ALL MY CODE AND STARTED A NEW TUTORIAL
@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 Жыл бұрын
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 Жыл бұрын
Line 9:Identifier "slot_gui_input" not declared in the current scope. It gives me this error
@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 :)
@LoudSodaCaleb3 жыл бұрын
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.
@froggyboo6842 жыл бұрын
Yeeeeeeeeeeah
@ToastedGears4 жыл бұрын
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
@hunterlepage2 жыл бұрын
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
@Annmariekahn11 ай бұрын
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.
@DinomaxProductions9 ай бұрын
Thank you for this comment, I made the exact opposite mistake and couldn't figure out what was wrong
@thedevine37564 жыл бұрын
Quick, straight to the point, efficient. Good tutorial
@souvlaki422 жыл бұрын
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?
@erengazioglu3 жыл бұрын
GREAT tutorial! Tons of tiny revelations that're going to make _anyone's_ life easier. Cheers for good content!
@inhadar11 Жыл бұрын
You are best, my friend. You saved me from write algorithm from scratch. Really good tutorial
@MarisaClardy4 жыл бұрын
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.
@Arkeve4 жыл бұрын
Thanks! Well, I spend most my time refactoring old implementations so dont get to down about it. Good luck on your project!
@titans74554 жыл бұрын
Perfect timing to upload this I needed this
@Arkeve4 жыл бұрын
Glad I could help!
@titans74554 жыл бұрын
When’s part two
@titans74554 жыл бұрын
And can u make it so I can pick them up? In part 2
@ILoveWatchingTy4 жыл бұрын
@@titans7455 yea like a adding system
@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 Жыл бұрын
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 Жыл бұрын
@@BartiqDnBsame problem
@faithfearless46564 жыл бұрын
This, worth a subscribe from me. Can't wait for another one.
@Arkeve4 жыл бұрын
Thank you! Ill try to release the next one as soon as possible
@theravenpirate47443 жыл бұрын
Wow this has been super helpful with my game. Thank you so much!
@Arkeve3 жыл бұрын
Glad to hear it!
@theravenpirate47443 жыл бұрын
@@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?
@Shadowthevampire10 ай бұрын
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-fu4jj3 жыл бұрын
i have an issue in line 38 in slots.gd it says : Invalid set index 'position' (on base: 'Nil') with value of type 'Vector2'.
@BrandonTheOverthinker3 ай бұрын
did you find a fix
@gilesaspin70833 жыл бұрын
Easy to follow and well explained, well done...
@mrsentixy81963 жыл бұрын
for anyone who is wondering if it works, it works just follow his instructions (Dec 15, 2020)
@nieli76952 жыл бұрын
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 Жыл бұрын
in project settings, input mapping
@maxwamsley3 жыл бұрын
Holy sheet how does this guy not have more subs
@qloxhost3 жыл бұрын
I like the way you make tutorials I would like you to make a full functional game with tutorials :)
@qloxhost3 жыл бұрын
Is this a yes?
@goldengoblinX3 жыл бұрын
Dude, you are the best in this job
@kamos22164 жыл бұрын
even after like 2 motns i found gold mine real big thanks
@shrippie-42146 ай бұрын
Steve Worcester thanks : inv_slot.gui_input.connect(slot_gui_input.bind(inv_slot))
@petbij2 жыл бұрын
lovely tutorial. My thanks!
@MrSakfi4 жыл бұрын
Nice job... Go on, Bro.
@andersstrom7404 жыл бұрын
Thanks dude. u r the best!
@Arkeve4 жыл бұрын
:)
@theeternalwanderer3499 Жыл бұрын
thx this is a nice and clean tutorial
@KanishkaDilshan4 жыл бұрын
Looks great!
@hiddenascension36244 ай бұрын
this code has changed with godot update also from set("custom_styles/panel", default_style) to set("theme_override_styles/panel", default_style)
@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"?
@SILVERjavier2 жыл бұрын
gui_input(event: InputEvent)Emitted when the node receives an InputEvent.
@aleksitjvladica.2 жыл бұрын
Thank you.
@ILoveWatchingTy4 жыл бұрын
I love the video but have one question Would it be bossible to intergrate like a description system like rarity type
@Arkeve4 жыл бұрын
Yeah ill go over adding item descriptions as well in future parts. You can see an example in my latest devlog
@ILoveWatchingTy4 жыл бұрын
@@Arkeve Nice man keep it up i see a great future for you :)
@FrancoisSchnell4 жыл бұрын
Just discovered the channel with this video, cool! subed and keep it up! :)
@Arkeve4 жыл бұрын
Thanks for the support! :D
@nathanmasakadza41722 жыл бұрын
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
@Bluelight823 жыл бұрын
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
@ALEKSONEARTH3 жыл бұрын
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?
@Glacialan4 жыл бұрын
I love this!
@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!
@rchannel16933 жыл бұрын
I love your videos!!! U are da best
@BronsoloTV3 жыл бұрын
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.
@panicasherpanic67762 жыл бұрын
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?
@Stretox2 жыл бұрын
@@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.
@jvstAsYouAre4 жыл бұрын
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?
@jvstAsYouAre4 жыл бұрын
I had literally forgotten if holding item != null under the slot_gui_input funtion. Leaving this here incase someone makes the same mistake
@nieli76952 жыл бұрын
u are a life saver... ty so much... T.T
@GrowthforGames4 жыл бұрын
Great video!
@jazzy83913 жыл бұрын
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.
@fernandobarbosa253 жыл бұрын
I think it's get_children() instead.
@adabi81622 ай бұрын
The same isn't working even with get children@@fernandobarbosa25
@nyctimus60154 жыл бұрын
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
@Arkeve4 жыл бұрын
The colon just specifies the type, it isnt necessary. I created the variables but i assign values to them in the ready function.
@jomarllamas78903 жыл бұрын
Can this be applied in 3d
@anjanavabiswas88353 жыл бұрын
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?
@TheTheSusssu4 жыл бұрын
Thank you for sharing!
@Arkeve4 жыл бұрын
Anytime ! :D
@TheRealKaiProton10 ай бұрын
3:15 why TextureRect and not Sprite ?
@shrippie-42146 ай бұрын
I think its because TextureRect can get input
@Maxstate2 ай бұрын
My slots are too small for the items :( They aren't aligned properly (Godot 4)
@mrnowaatv12054 жыл бұрын
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
@mrsentixy81963 жыл бұрын
same, idk why
@mrapexpredator90410 ай бұрын
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
@dirkkruger19342 жыл бұрын
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
@bnkm072 жыл бұрын
before i start watching the whole playlist i wanna ask if this works in 3d?
@GorblinRat2 жыл бұрын
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..
@fye56023 жыл бұрын
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()"
@connorjade54608 ай бұрын
when will u update the videos for godot 4??
@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
@Yoni1233 жыл бұрын
How about using a gsmepad instead of a mouse?
@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_B2 жыл бұрын
I've follow step by step, but i can't swap the items. It won't move 🤔
@michaelbennaim94633 жыл бұрын
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 Жыл бұрын
how to resize the images? your code works but the images appear too big not scaled to the grid slots
@jongeorge33584 ай бұрын
Im having this problem too
@noahgranger67493 жыл бұрын
Will this tutorial still work in 3d?
@Thisisdcode4 ай бұрын
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-u7m1k4 ай бұрын
Thank a ton!
@ragnarhagberg67163 жыл бұрын
This does not work for me when exported to windows. I think my code cannot access the JSON file
@darkhunter7773 ай бұрын
Стили и закраски ячеек, не обязательно было в туториал запихивать 😁
@ClassicMushroom3 жыл бұрын
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.
@jnju51123 жыл бұрын
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
@solicity17854 жыл бұрын
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
@Arkeve4 жыл бұрын
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!
@solicity17854 жыл бұрын
@@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!!
@Yukaraoke3 жыл бұрын
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.
@Arkeve3 жыл бұрын
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.
@Yukaraoke3 жыл бұрын
I've started using Godot now and I'm following your tutorials. Thanks a lot for this. You deserve all support 💕
@Yukaraoke3 жыл бұрын
I've started using Godot now and I'm following your tutorials. Thanks a lot for this. You deserve all support 💕
@agriasoaks67213 жыл бұрын
Sir, why can't I move my item? Do you know what the problem might be?
@Sheol_Society5 ай бұрын
In the Inventory script change line 27 & 31 to holding_item.global_position = event.global_position this worked for me.
@Raformatico4 жыл бұрын
Great tut, thank you and cheers! 👏 +1 Subs
@Arkeve4 жыл бұрын
Thank you! Glad you found it helpful :D
@hamzailer4 жыл бұрын
omg tysm when is the next one coming out
@Arkeve4 жыл бұрын
Within the next few days
@hamzailer4 жыл бұрын
@@Arkeve ill be waiting :D
@geckokun28053 жыл бұрын
Cool!
@JMXBEATS3 жыл бұрын
I had a problem where in pickFromSlot it said I was attempting to add a child in a null instance on a null instance
@millioncats57903 жыл бұрын
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
@samuelkelly50613 жыл бұрын
Hey can someone please help in my inventory script says that it cant call the method "gui_input"
@potat16584 жыл бұрын
Is there a difference between a node and a node 2d?
@Arkeve4 жыл бұрын
Node2D is usually used for 2d games and Node is used for 3D
@definitelymdt2 жыл бұрын
Does this work for Android too?
@markwakin4904 жыл бұрын
What size is ur window?
@Arkeve4 жыл бұрын
480 by 270
@hunterlepage2 жыл бұрын
would've been a good tutorial if you didn't copy and paste everything and actually explained them instead
@n3rf5913 жыл бұрын
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-42142 жыл бұрын
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_B2 жыл бұрын
Same, it happen to me too. I've try to add and set an Input Map "BUTTON_LEFT", yet it still didn't work :/
@msamil6793 жыл бұрын
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.
@youbadassXneb3 жыл бұрын
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.
@dipievil3 жыл бұрын
Dude.... You just saved aonther idiot here! Thanks
@micka3943 жыл бұрын
i got the error Nonexistent function instance in base GDscript can anyone pls help
@ClassicMushroom3 жыл бұрын
You have to show your code if you want help
@micka3943 жыл бұрын
@@ClassicMushroom thanks for the help but i deleted the script already
@ArtembAartemb3 жыл бұрын
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
@gersongerson24813 жыл бұрын
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
@agriasoaks67213 жыл бұрын
@@gersongerson2481 what is this "item" in the code of the inventory?
@gersongerson24813 жыл бұрын
@@agriasoaks6721 The item is the object that slot hold.
@agriasoaks67213 жыл бұрын
@@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?
@gersongerson24813 жыл бұрын
@@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.
@isaac82283 жыл бұрын
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?
@isaac82283 жыл бұрын
it was the "func input():" remember to make it "func _input():"
@Paulos7773 жыл бұрын
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?
@lightbreathermusic3 жыл бұрын
the function must be defined as func putIntoSlot(new_item): what this does is it defines a function and a local variable
@ernst11832 жыл бұрын
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.
@v84l422 жыл бұрын
if !slot.item: means if slot item is false if (slot.item): means if slot item is true
@ernst11832 жыл бұрын
@@v84l42 Ok! Thanks for your answer!
@mathislalonde3539 ай бұрын
still working ?
@oOoSairenoOo8 ай бұрын
Yes, in 4.2 Godot, but u need to do some changes
@juiceman76493 жыл бұрын
Buy PYTHON crash course book to all you first time coders really gives thorough context to all the online tutorials you'll go through.
@Mastercar772 жыл бұрын
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. :(
@v84l422 жыл бұрын
use inv_slot.connect("gui_input", slot_gui_input, [inv_slot])