advices on how to make a inventory?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By triangulo

hey, i’m planning to do a simple arrow based inventory, and i don’t know where to start, someone have a tip or trick that i can use, or an advice on how to do it?

:bust_in_silhouette: Reply From: blurrred

I guess this shouldn’t be that difficult, depending on what you want to accomplish.

I would recommend focusing on Control nodes. A simple UI can be achieved with, say, a VBoxContainer to list the items and another VBoxContainer to keep track of the arrow. Both of these can be children of an HBoxContainer to keep them side-by-side neatly.

As far as code is concerned, that’s where some difficulties may arise. I’d recommend keeping a list (array) of what your character currently has in their inventory. Something like var inventory = [] should suffice for a simple implementation. Just add the objects (items) to that array when your character gets them.