I’m working on a simple game in Java, and I’ve hit a bit of a roadblock. I don’t know anything about scripting, such as using LUA, so I’m trying to think of a way to handle this. I need to add different weapons to my game, but as far as the weapon class goes, I need to make it flexible enough to handle any type of weapon… so what I was thinking of doing is to make a simple class with some general parameters, and then make an interface for it to implement that will have the functions that need to be specific.
From there, I was hoping I could create an enumerator containing anonymous inner classes. This way, I could create a separate file with mappings of IDs like “FLAMETHROWER” to an anonymous inner class where I could hard-code the effects that those weapons would display. Is this possible? If so, how could I do this?
If this isn’t possible / a good idea, what would you recommend? I can provide a link to the project on Github if you need to see the code.