Teleport closest node?

I tried following an inventory tutorial, but it didn’t work, and when I made a post asking for help here, I was encouraged to make my own.

Yes but i mean a general beginner’s tutorial where you for example learn what arrays are and how to use them.

Not trying to sound rude or condescending but it feels like it could be a bit early to try to add these slightly more advanced features, that requires some knowledge about arrays.

Ah, okay. And no offense taken. Do you have any recommendations?

When i started learning coding i remember as especially helpful GDquest’s “coding game” where you get to practice different GDscript features in a gamelike setting, and Godotneers’ two part tutorial.

Some things may be too easy for you but if you find something you struggle with or feel like you need to learn more about, just note it down and search for more information about those features later.

https://school.gdquest.com/courses/learn_2d_gamedev_godot_4/learn_gdscript/learn_gdscript_app

Okay, thanks! I’ll look at these.

Good decision!

Okay, so the Godotneer’s video is confusing, and I just don’t get Gdquest. At what point is it a me thing?

Give it some time! Start over if needed or try a few different. Brackeys made one for complete beginners too. It took some time for it to click. If it never clicks, give up and try to find someone to collaborate with, but try giving it some time first.

@Perry_Brigman You know what.There are only two hard things in computer science:

  1. Naming things,
  2. Cache invalidation

Please use proper naming.var is_in = 0 doesn’t make any sense to outer people.

Can you show that what is really happening in your game? How the slot system works?

Ah, sorry about the naming. Is_in means the item is in the slot.

I’ve never thought of collaborating with someone. I think I’ll try to avoid it for this game, because this is my first realgame and I kinda want to do this one in my own.

I have found the problem! It doesn’t work when I duplicate the item, because godot can’t have 2 nodes in the same scene with the same name, so it creates it as Item2. So now I just need to find a way to work it with ALL names, as long as they derive from the item scene itself

Do you mean duplicate it in the editor? Like placing three items? Or duplicate in code while managing the item?

Either way: Yes! Better to avoid using names at all here. It will be a hassle to loop over an unknown number of items and decide what to do or not do with each one. Just make it so that an area can detect your item-class, either through code or by using layers, and completely skip anything that has to do with names.

Yes, I duplicate it in the editor. Can you kinda walk me through the layer thing you just described? I’m sure I could do it on my own, but it would be much appreciated.

Its a property on area2d-nodes. You can decide which layers an area will detect and be detected by. Mask layer decides what to detect and layer decides where itself will be detected.

Look up a tutorial. It will be easier when you see it clearly in front of you.

Okay, so I’ve done my research and now know about layers in area2ds. New problem; I still don’t know how to do what you said with this new power.

Try it! You will learn by trying. I just sat for several hours with something here and finally got it to work. It’s the best way to learn. If you can’t get it to work after trying for an hour create a new thread here and ask for help. Right now we are here at the end of a 57 post long thread that has changed topics multiple times.