Citrus-Engine icon indicating copy to clipboard operation
Citrus-Engine copied to clipboard

Hero , facing direction, moving platform

Open gsynuh opened this issue 11 years ago • 1 comments

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.

gsynuh avatar Nov 15 '13 21:11 gsynuh

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 ;)

alamboley avatar Nov 15 '13 23:11 alamboley