|
I want to create an inventory system that keeps track of the amount of each item you have and are able to scroll through each one and selecting which ever item will activate it. I'm unsure what exactly to use to accomplish this. Should I use an array of items that keeps track of the item name and how many of each you have? Also I don't know how to make it so when you scroll through that the system can keep track of which item you are on by displaying an arrow next to it and then tell if it has been selected. Once selected I am also unsure of how to activate a certain function from that array. So here's an example of how it would look ingame.
(comments are locked)
|
|
The structure of your program will be a little more complex than using an array. You will best use some object oriented concepts. Read them up if you do not know about them. The way I would design the inventory system: Have an inventory class with a list of inventory items. Inventory items are again a class which consists of a pointer to an inventory object (your potions in this case) and a counter. You will also need to implement some kind of GUI in the inventory class with a cursor through which you can activate your inventory item and decrement the counter.
(comments are locked)
|

Have you ever done a programming course? This looks suspiciously like the kind of thing they get you do to in those... Of course, doing it in the 'print x chars then print name' method isn't really appropriate for Unity.
I have but I am not very good or haven't done a lot of programming using arrays and such... What I'm trying to do is a little complex. Being able to scroll through and select each item and if there's atleast one then your able to use it.
Well, if you want to make games, get good at programming. There's really no way around it- it won't be possible for you to do a lot of things without knowing how to break down a task into algorithms, and how to tell a computer how to implement those algorithms.
I couldn't agree more with syclamoth. Although this particular task isn't extremely hard to overcome, your main friend here is for-loops and arrays (to start with). It also depends on which platform this is intended for.