game loop & mode changes - is this standard way of doing it?

Background - In terms of building a typical action game where the figure can undergo different modes (e.g. running, walking, falling, etc) I had an issue whereby I thought it was caused by multiple mode changes occuring within the same game loop, so the end result was a mode change was missed. I guess the way I’d programmed the modes structure was not too tolerant to a mode being jumped. So I did the following

Mode Change Approach (is this normal / good practice)
* Listener Phase

  • listeners funnel updates to a single “update_mode” function
  • the update_mode function does only basic checks then adds to the new mode to a mode buffer
    * Game Loop
  • takes the next mode change off the mode change buffer and processes it
    Just wondering if this is standard practice? Or if not what is typically done. I guess the problem space is one where you can have multiple/various listener events triggering mode changes from different places, and how to avoid and confusion/issues due to this. One approach might be to make the inherit game loop & mode structure such that it can jump from any state-to-any-state at any time, and design it so that this doesn’t cause any adverse issue… [import]uid: 140210 topic_id: 35774 reply_id: 335774[/import]