Well, I felt bad about saying that the wizard tutorial didn't end well, so I've modified it a bit to work like I would expect. You can get the original project here. My updated project is available here. The main modification is to throw out a lot of the state related code. The original list of states is:
//The various states the Wizard can be in
protected enum WizardState
{
Standing,
Walking,
Magicking,
Ducking,
Jumping
}//End enum WizardState
I've replace them with
//The various states the Wizard can be in
protected enum WizardState
{
Normal,
Ducking,
Jumping
}//End enum WizardState
In the original project, the code only allows for one state at a time, so you end up not being able to walk when jumping, or magick while walking or jumping. So i took the actions i wanted to be able to do during all times, specifically walking and magicking, and moved those out of the state enum. They shouldn't be treated as states. They're just actions the wizard can take. Then I realized there needed to be some sort of base state, so I added the Normal state, which is just the default.
The other big change is in the UpdateKeyboard function. Instead of an if..else if...else if chain of code, I changed it to a series of if statements so the UpdateKeyboard function will respond to all keys being pressed at once, rather than responding to one and returning.
One final minor change I made was to pull out the crouch animation when the wizard lands. I didn't like it. I've avoided posting code in here until I know how to get it formatted correctly... another action item, I suppose.
The end result, if you build my version of the project, is a wizard that can move and magick while jumping. It feels much more responsive, and makes me feel like I have a lot more control over the wizard.
There. I feel better now.
Wednesday, February 27, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment