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
import { onKeyboardEvent } from "../tools"; | |
export default class PlayerComponent extends Mesh { | |
// ... | |
/* | |
* An example of keycode reference : https://keycode.info/ | |
*/ | |
/** | |
* Moves the player on the left | |
*/ | |
@onKeyboardEvent(65, KeyboardEventTypes.KEYDOWN) | |
protected moveLeft(): void { | |
this.position.z += 5; | |
} | |
/** | |
* Moves the player on the right. | |
*/ | |
@onKeyboardEvent(68, KeyboardEventTypes.KEYDOWN) | |
protected moveRight(): void { | |
this.position.z -= 5; | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment