Hi, again, Guv!
Sorry for the delay, but I wanted to communicate this as clearly as I'm able.
Here's a complete mini game that uses this technique to lock direction of movement -- I wrote up the approach that I took in the README:
I hope this is helpful. Feel free to ask follow-up questions!
Jacob