He just posted, right before you what he was currently doing. I'm assuming he's started at least making some prototyping codekikito wrote:I was under the impression that he was not yet *doing* anything, but thinking about ways of doing things, and asking questions.tsturzl wrote:It really seems like what he's doing is actually easier, IMO. Really the concept isn't that hard to grasp...
Ok, I see where stateful is handy. I just don't think this is the scenario. I'm not sure, but what he seems to want to do is swap parts of different characters. Possibly gradually transforming between the 2. I'm not quite certain. I don't know if stateful is meant for this.Stateful provides a couple tools to deal with this complexity: first, states are stackable (so megaman can be "jumping" and "wood-powered" at the same time), but the code has no "ifs": instead, methods are overriden in certain order.
Second, one state can "inherit" from another, so if two states are "mostly the same except from one bit" the code isn't duplicated; when you change the parent, you don't have to remember changing the child.
Finally, there are callbacks that are automatically called every time a state is entered/exited (or pushed/popped from the state stack). If you need some initialization code to be called every time that megaman changes from one other power to "IcePower", Stateful makes sure that that method is called; you don't have to remember it.
I'm not saying it is the ideal solution, but I'm certain it's worth considering.
I also think its a good learning experience to do it manually, because then he'll have an understanding of how stateful works, thus being able to use it better.
Not at all. I'm just saying, if its simple to implement why use a library? I suppose if you're building the entire game with stateful it would be useful, but I don't think that'd be a good idea. I think doing things manually is a good way to learn, and will also better suite his needs.I don't know what to make of that phrase. You seem to be implying that using libraries, or learning to use them, is a bad thing.tsturzl wrote:Using stateful.lua just seems like another library to learn.