Last active
August 6, 2020 21:50
-
-
Save virgs/8eee027ad8b1eadb940ff480dc00a389 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| export class MainScene extends Phaser.Scene { | |
| //... | |
| public async create(): Promise<void> { | |
| EventManager.emit(Events.GAME_BEGAN); | |
| new BoardHandler({scene: this}); | |
| new AliveBlockHandler({scene: this}); | |
| new InputManager({scene: this}); | |
| EventManager.emit(Events.BOARD_CREATE_NEW_BLOCK); | |
| } | |
| public update(time: number, delta: number): void { | |
| this.totalTime += delta; | |
| this.updateTimeCounterMs += delta; | |
| if (this.updateTimeCounterMs > this.milliSecondsPerLevel) { | |
| this.updateTimeCounterMs %= this.milliSecondsPerLevel; | |
| this.milliSecondsPerLevel = Math.max(this.milliSecondsPerLevel * .999, 85); | |
| EventManager.emit(Events.GO_DOWN_ONE_LEVEL); | |
| } | |
| EventManager.emit(Events.UPDATE, delta); | |
| } | |
| //... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment