feat(achievements): implement unlocking, saving and notification

This commit is contained in:
2026-01-18 22:50:35 +01:00
parent d61a60132a
commit d7e626397a
13 changed files with 269 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import * as THREE from "three";
import { useIntervalFn, useLocalStorage } from "@vueuse/core";
const store = useSettingsStore();
const achievements = useAchievementsStore();
const confirmationModal = useConfirmationModal();
const { onRender } = useScreen();
@@ -56,7 +57,11 @@ const handleConfirm = () => {
break;
}
case "waiting":
case "waiting": {
achievements.unlock("snake_play");
spawn();
break;
}
case "dead": {
spawn();
break;
@@ -101,6 +106,10 @@ const eat = () => {
highScore.value = Math.max(highScore.value, score);
food.copy(randomFoodPos());
score += 1;
if (score === 40) {
achievements.unlock("snake_score_40");
}
};
const die = () => {