Skip to content

Commit

Permalink
Make the snakes change slightly less often.
Browse files Browse the repository at this point in the history
  • Loading branch information
robholland committed Sep 6, 2024
1 parent 284268f commit a493e7a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion snakes/src/lib/pages/SnakeRoundPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
timerInterval = setInterval(updateTimer, 1000);
if (isDemo) {
demoInterval = setInterval(moveRandomSnake, 50);
demoInterval = setInterval(moveRandomSnake, 100);
}
}
Expand Down
3 changes: 2 additions & 1 deletion snakes/src/lib/snake/SnakeBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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<Direction, [[number, number], [number, number]]> = {
"up": [[0.25, 0.25],[0.75, 0.25]],
Expand Down
2 changes: 1 addition & 1 deletion snakes/src/lib/snake/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type Round = {
startedAt?: number;
finished?: boolean;
};

export type Point = {
x: number;
y: number;
Expand Down

0 comments on commit a493e7a

Please sign in to comment.