diff --git a/src/input/Keyboard.js b/src/input/Keyboard.js index c4ed3d6b0..58724f4cb 100644 --- a/src/input/Keyboard.js +++ b/src/input/Keyboard.js @@ -167,21 +167,18 @@ Phaser.Keyboard.prototype = { * @return {object} An object containing user selected properties */ addKeys: function (keycodes,hotkeys){ - if(keycodes.length === hotkeys.length) - debugger; + var result = "{"; + for(var i = 0; i < hotkeys.length; i++){ - var result = "{"; - for(var i = 0; i < hotkeys.length; i++){ + result += hotkeys[i] + ": this.addKey(" + keycodes[i] + ")"; - result += hotkeys[i] + ": this.addKey("+keycodes[i]+")"; + if(i !== ( hotkeys.length-1 )) + result += ","; - if(i !== (hotkeys.length-1)) - result += ","; + } + result += "}"; - } - result += "}"; - - return(eval("("+ result +")")); + return(eval("(" + result + ")")); },