Created
December 27, 2017 13:06
-
-
Save drFabio/6accf0d55b2bf945173d933d5a5ed4b5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_listenToKey(ev) { | |
if (ev.code === 'Enter') { | |
if (!this.state.running) { | |
this._startGame() | |
} | |
} | |
if (this.state.running) { | |
if (ev.code === 'Space' || ev.code === 'ArrowUp') { | |
this._controls.up++ | |
} | |
if (ev.code === 'AltRight' || ev.code === 'ControlLeft' || ev.code === 'AltLeft' || ev.code === 'ControlRight' || ev.code === 'ArrowDown') { | |
this._controls.down++ | |
} | |
if (ev.code === 'ArrowRight') { | |
this._controls.right++ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment