feat(achievements): implement unlocking, saving and notification
This commit is contained in:
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user