   Events, States, Input Help
  I'm unclear on how to implement a flexible way to hook my input in to my entities, and more specifically, what to do with it after it gets there.Here's some background info: my project is based off of the framework from a tutorial found at www.kalme.de. It's in C# and uses DirectX 9. I have read through the Enginuity articles and am interested in rewriting my code to be event-based. But, before I do so I need to get a better grasp on how this would work.I have a twofold question.Part A: I have an entity which is controlled by user input. How does the input get from the gamestate to the specific entity?Part B: My enetity will have states. Say, when it's recieveing no input it's state is "idle," when you press left or right it's set to "run". How should these events be broken down? More specifically, how can I make this in to something generic? My enemies will have to be idle, run, and jump as well. Also, where should I put the code to check which state the object should be in? If you're jumping and reach the height of the jump and start to fall, the state should be changed to "falling". How do you handle this?I'm all over the place on this one. I need to bring it together and make it clean and flexible enough to be reused.Any input is welcome!   
  Hi,These were a lot of questions, and I'll try to answer them as much as I can...First I'd go with a "Character Controller".  The character controller is there to feed virtual inputs to the character.  A character can be either the player or its enemies.  The goal here is to have the controller set flags that the character will read in its update loop.  These could range from [-1,1] left/right values, boolean Jump, boolean Action, boolean Fire, etc...  You can then create a "Pad" controller which reads the pad, and fills the flags according to the input the player gave.  Else, you can have an AI controller which fills the flags according to its intentions.For the states, you should read Mat Buckland's article (its part of a chapter of his book Programming Game AI by Example), it gives a good explanation on how to setup a state system, and how to update the states.Hope this helpsEric   ;  It certainly does help. I will read and update as I am able. Thank you.   