From d1aa302b79006a61d88788304a11bad8295fea2b Mon Sep 17 00:00:00 2001 From: qdrj Date: Wed, 12 Mar 2014 22:29:32 +0400 Subject: [PATCH] add missing Keyboard.removeKey method --- src/input/Keyboard.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/input/Keyboard.js b/src/input/Keyboard.js index f99cd173a..6b9d31027 100644 --- a/src/input/Keyboard.js +++ b/src/input/Keyboard.js @@ -116,6 +116,24 @@ Phaser.Keyboard.prototype = { }, + /** + * Removes a Key object from the Keyboard manager. + * + * @method Phaser.Keyboard#removeKey + * @param {number} keycode - The keycode of the key to remove, i.e. Phaser.Keyboard.UP or Phaser.Keyboard.SPACEBAR + */ + removeKey: function (keycode) { + + if (this._keys[keycode]) + { + + delete (this._keys[keycode]); + + this.removeKeyCapture(keycode); + } + + }, + /** * Creates and returns an object containing 4 hotkeys for Up, Down, Left and Right. *