Citrus-Engine
                                
                                
                                
                                    Citrus-Engine copied to clipboard
                            
                            
                            
                        Hero , facing direction, moving platform
Current hero behavior :
- when hit by an object fast enough, the hero faces the other way.
 - on a moving platform, the hero may change direction or not face the direction the player is going for.
 
Suggested hero behavior :
- remove the dependency of _invertX and the body's total velocity. instead, on an update, see if the player requests movement and change _invertX according to that movement so :
 - whatever happens on a moving object/platform, the hero will face the way the player tries to go
 - when hit by a fast object the hero will not face the other way , if this is not an acceptable change, the "look the other way when hit" needs to be a special case in handleBeginContact when we would only look at the colider's x velocity and angle to decide on whether we need inverting or not. the way the hero face's will be reset to the player's decision on his next left or right action.
 
Indeed, Hero is based on its physics behavior instead of user input.
Combining input and physics may remove those unexpected behavior, so I would agree with that way ;)