Hey Everyone,
I have a very broad question about best practices for storing enemy attributes or other sprite instance object. I am making my first game and my Family "Enemies", which contains all my various enemy object types, has gotten up to 31 attributes that I'm tracking in the Family instance-variables. I've been reading about Dictionaries, wondering if they were a better way to store all the enemy attributes and figured I should make that decision sooner rather than later. So with that in mind, I'm open to any suggestions and/or explanation, but my main questions are:
- If I have lot of enemy types with lots of differing attributes and I have an "Enemy" Family containing all of them. Is there any reason NOT to put all the enemy attributes in the "Enemy" Instance Variables, vs using the instance variables on each individual enemy object type? Does it make a difference if many of my enemy types will use unique (or only in a small subset) attributes that won't be used at all by the other enemy types?
- Is the Dictionary vs Instance decision based on the number of variables? At what number of variables would you switch?
- In general, what advantages do Dictionaries offer over Instance Variables?
Thanks for your time if you respond to this.