7 Replies Latest reply on Jul 28, 2014 8:59 AM by kglad

    How do you "lock" the keyboard from users being able to press keys?

    konsume117

      Hi all!

       

      I have a question about, let's say, "locking" the keys on the keyboard, so that a user cannot activate any actions in the game by pressing keys. I have a game that I'm working on which has separate animations inside the "main character" symbol, things like idle, walking, jumping, etc (like in most flash games). When he is "jumping" or "activating his power", he starts an animation, which is normal.

       

      But the problem that I cannot figure out is that when he is half way through he's animation (in mid-jump or something), if you press another key, like the "move left" key, he instantly snaps out of his animation and jumps back to his original position.


      Now I was wondering if there was some code that 'deactivated' or 'locked' the keyboard for the length of that animation, so that the user couldn't interrupt the animation.

       

      I'm using Key.isDown code as usual and I have tried !Key.isDown.