Skip to content

Instantly share code, notes, and snippets.

@melcor76
Created November 19, 2019 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melcor76/5c61d1576b184a371c36ef1baed4f3cc to your computer and use it in GitHub Desktop.
Save melcor76/5c61d1576b184a371c36ef1baed4f3cc to your computer and use it in GitHub Desktop.
js-tetris - lines and level
if (lines > 0) {
// Calculate points from cleared lines and level.
account.score += this.getLinesClearedPoints(lines, this.level);
account.lines += lines;
// If we have reached the lines for next level
if (account.lines >= LINES_PER_LEVEL) {
// Goto next level
account.level++;
// Remove lines so we start working for the next level
account.lines -= LINES_PER_LEVEL;
// Increase speed of game.
time.level = Level[account.level];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment