-2

I just wonder what do I hardcode in my game? E.g do I have an external file for every Enemy properties so on or do I make a class?

So what info/stuff should I code and what should I have as a .file?

Cheers!

AndroidXTr3meN
  • 399
  • 2
  • 9
  • 19

1 Answers1

1

Make a properties file, and instantiate a bean when you need that type of property. There aren't many good reasons to hardcode things. At the very least, make the hardcoded items into constants: public static final int XYZZY = 0;

That being said, I'll hardcode to get something working or for prototyping. Then I'll go back and generalize it.

Tony Ennis
  • 12,000
  • 7
  • 52
  • 73
  • So I should use files instead of classes to store Info? – AndroidXTr3meN May 14 '12 at 12:35
  • It's hard to say definitively without seeing an example or knowing more about your app. If there were 100 different types of Enemy, probably. If there are 3, maybe not. In the ideal world you'd be able to create one class whose behavior changes based upon the properties file. At this point you get into more interesting implementations. – Tony Ennis May 14 '12 at 13:13
  • Well ye alot of diffrent "enemies" and weapons. So I consider making my game import those files. thanks! – AndroidXTr3meN May 14 '12 at 13:17