could someone please direct me to a good place for me to work on classes? i am working on a very simple text based game and i put in an inventory system. using if statements. i know its a bad way to do it. but thats how i knew how to so i did it and it works. but i want to work on doing this the "Proper" way. now i know it will probably still be far from good but just an improvement from what i have.
i know some basics on classes but dont know how to apply to what i want to use them for.
ok. thanks but a lot of that is more advanced then what i am capable of. what it looks like to me is pretty much replace the: "if(PrimaryHandItem == 0)" with the "case 0;"
would that be a true statement or not?
and the other part i am not familiar with is the
for(int i=0;i<SIZE;i++)
i guess its fairly straight forward to me it looks like an if but it only happens if parameters are true. im not sure to be honest though.
To be honest, I don't think that's the greatest example of using classes to find a data-driven solution, as opposed to a hardcoded one.
As OP has already noticed, it's not really any different from his original code (
what it looks like to me is pretty much replace the: "if(PrimaryHandItem == 0)" with the "case 0;"
).
If you want, I can write a quick example that would make more sense in my eyes, however, you may not understand it.