Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* 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
You can’t perform that action at this time.