I do not fully understand what an enum is exactly. Is it like arrays and lists. If not how are they different
It is sort of description. For example : you have inventory equipment and items.
can you equip pants in head slot? Of course. How to avoid this?
Use enum. enum ItemType = { head, chest, pants, weapon …}
Then when you equip an item you can check whether its a head or anything else.
Other example. enum ItemAttribute = { health, strength, agility …}
when you equip item that has buff on it, you want that buff to apply to a player.
Using enum you will know that item attribute is strength and that player get correct buff.
1 Like
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.