diff --git a/snakes/src/lib/pages/SnakeRoundPage.svelte b/snakes/src/lib/pages/SnakeRoundPage.svelte index b536c10..b676992 100644 --- a/snakes/src/lib/pages/SnakeRoundPage.svelte +++ b/snakes/src/lib/pages/SnakeRoundPage.svelte @@ -39,7 +39,7 @@ timerInterval = setInterval(updateTimer, 1000); if (isDemo) { - demoInterval = setInterval(moveRandomSnake, 50); + demoInterval = setInterval(moveRandomSnake, 100); } } diff --git a/snakes/src/lib/snake/SnakeBody.ts b/snakes/src/lib/snake/SnakeBody.ts index 9a3dfe5..55fbc54 100644 --- a/snakes/src/lib/snake/SnakeBody.ts +++ b/snakes/src/lib/snake/SnakeBody.ts @@ -48,7 +48,7 @@ export default class SnakeBody { } redraw(segments: Segment[]) { - this.snake.segments.forEach((segment, index) => { + this.snake.segments.forEach((segment) => { let { x, y, w, h } = this.calculateRect(segment); this.context.clearRect(x, y, w, h); }); @@ -63,6 +63,7 @@ export default class SnakeBody { const head = index === 0; let { x, y, w, h } = this.calculateRect(segment); this.context.fillRect(x, y, w, h); + if (head) { const locations: Record = { "up": [[0.25, 0.25],[0.75, 0.25]], diff --git a/snakes/src/lib/snake/types.ts b/snakes/src/lib/snake/types.ts index 5f7cb15..df3877c 100644 --- a/snakes/src/lib/snake/types.ts +++ b/snakes/src/lib/snake/types.ts @@ -45,7 +45,7 @@ export type Round = { startedAt?: number; finished?: boolean; }; - + export type Point = { x: number; y: number;