diff --git a/app/nose/bin/tetris.ts b/app/nose/bin/tetris.ts index 4b160d0..b61846a 100644 --- a/app/nose/bin/tetris.ts +++ b/app/nose/bin/tetris.ts @@ -1,4 +1,9 @@ /// +// A classic. +// +// Arrow keys move your tetrinome. +// Space bar rotates. +// Enter pauses the game. export const game = true import type { GameContext, InputState } from "@/shared/game" @@ -219,7 +224,7 @@ export function update(_delta: number, input: InputState) { if (++moveTick % MOVE_TICK === 0) detectMovement(input) - if (++downTick % DOWN_TICK === 0) + if (++downTick % downTickForScore() === 0) if (!collision(player.x, player.y + 1, player.rotation)) { player.y++ } @@ -300,6 +305,10 @@ function findFullRows(): number[] { return rows } +function downTickForScore(): number { + return Math.max(1, DOWN_TICK - Math.floor(score / 1000)) +} + function removeClearedLines() { const newGrid: string[][] = [] score += LINE_SCORES[clearedLines.length - 1] || 0