Well, what I would do is make a variable when the object is created called mobile, then aftter it's initialized, set it to 1. When the player is not supposed to move, set it to 0, and when they can move again, set it back to 1. Whenever a movement key is pressed, exit if that variable is not equal to one.