How to equip an item in your inventory?

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

I watched this video - - on building an inventory and im lost as to how to actually equip the items for my character to use

Can anyone help me? I’m not sure what code to write for it

Well, to save an item to my ‘inventory’, I would create a list.
Note that this is only saving data to a virtual data-container, it’s not creating any graphics or anything. You would have to create that yourself.

For example…

inventory = ["Magic Ring", "Magic Wand", "Flame-Breathing Dragon Head", "B-Grade Sword"]

and et cetera.

TheJokingJack | 2021-07-03 23:17

Well, I came back to this question a little later, and saw that it changed. I’m not really sure what you mean by ‘equipped’. Is it to set something programmatically? To actually have your item appear on screen?

Isn’t equipping something basically the same as changing a variable…

var item_equipped = "Magic Ring"

And creating something on screen based on that?

func _process():
#show item_equipped on screen?

TheJokingJack | 2021-07-11 16:09