Skip to content

Instantly share code, notes, and snippets.

@MikeShi42
Created August 13, 2018 17:48
Show Gist options
  • Save MikeShi42/84db797557558f7875f77f52f96bbb11 to your computer and use it in GitHub Desktop.
Save MikeShi42/84db797557558f7875f77f52f96bbb11 to your computer and use it in GitHub Desktop.
setup() {
if (!this.remotePlayer) {
this.inputManager.on("move", this.move.bind(this));
this.inputManager.on("restart", this.restart.bind(this));
this.inputManager.on("keepPlaying", this.keepPlaying.bind(this));
}
this.grid = new Grid(this.size);
this.score = 0;
this.over = false;
this.won = false;
this.keepPlaying = false;
if (!this.remotePlayer) {
// Add the initial tiles
this.addStartTiles();
}
// Update the actuator
this.actuate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment