Created
October 3, 2020 22:10
-
-
Save flushpot1125/c61fa4c4f2519f24841d86f918ee74ff 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
/** | |
* Registers the keyboard event to start game. | |
*/ | |
private _registerStartGameEvent(): void { | |
// Register the space keyboard event to start the game. | |
const spaceObservable = this.onKeyboardObservable.add((ev) => { | |
if (ev.event.keyCode === 32) { // space bar | |
this._ball.reset(); | |
this._ball.applyStartImpulse(); | |
this.onKeyboardObservable.remove(spaceObservable); | |
this._gameMessageControl.isVisible = false; | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment