I'm making a adventure game that (of course) has an inventory. I have solved this problem, but I wonder if there is a better to way to solve it. I have used arrays where i have stored the different locations of the items.
After that I have made a loop where it goes through all the arrays and couts the items that have the same location as the current room.Code:iloca = sword.ilocation; iloca = hammer.ilocation;
Is there an another way to make it go through all the items and cout those which are in the room? I have only two items now, but when I'm going to make some more items, it would get a bit boring to define all the arrays and there would be lots of code.