feat(nds): add audio in all menus

This commit is contained in:
2026-02-25 14:52:48 +01:00
parent 61aec3da2e
commit bbe20150ed
45 changed files with 240 additions and 117 deletions

View File

@@ -88,7 +88,7 @@ const handleActivateA = () => {
text,
onClosed: async () => {
await animateOutro();
store.closeSubMenu();
store.closeSubMenu(true);
},
keepButtonsDown: true,
timeout: 2000,

View File

@@ -156,16 +156,16 @@ useKeyDown(({ key }) => {
switch (key) {
case "NDS_UP":
if (selectedRow > 0) select(selectedCol, selectedRow - 1);
if (selectedRow > 0) { assets.audio.tinyClick.play(0.8); select(selectedCol, selectedRow - 1); }
break;
case "NDS_RIGHT":
if (selectedCol < GRID_SIZE - 1) select(selectedCol + 1, selectedRow);
if (selectedCol < GRID_SIZE - 1) { assets.audio.tinyClick.play(0.8); select(selectedCol + 1, selectedRow); }
break;
case "NDS_DOWN":
if (selectedRow < GRID_SIZE - 1) select(selectedCol, selectedRow + 1);
if (selectedRow < GRID_SIZE - 1) { assets.audio.tinyClick.play(0.8); select(selectedCol, selectedRow + 1); }
break;
case "NDS_LEFT":
if (selectedCol > 0) select(selectedCol - 1, selectedRow);
if (selectedCol > 0) { assets.audio.tinyClick.play(0.8); select(selectedCol - 1, selectedRow); }
break;
}
});
@@ -186,6 +186,7 @@ onClick((x, y) => {
rectContains([0, 0, GRID_SIZE - 1, GRID_SIZE - 1], [col, row]) &&
rectContains([0, 0, CELL_SIZE + 1, CELL_SIZE + 1], [cellLocalX, cellLocalY])
) {
assets.audio.tinyClick.play(0.8);
select(col, row);
}
});
@@ -288,7 +289,7 @@ const handleActivateA = () => {
text: $t("settings.user.color.confirmation"),
onClosed: async () => {
await animateOutro();
store.closeSubMenu();
store.closeSubMenu(true);
},
keepButtonsDown: true,
timeout: 2000,

View File

@@ -120,7 +120,7 @@ const handleActivateB = async () => {
onClosed: async (choice) => {
if (choice === "A") {
await animateOutro();
store.closeSubMenu();
store.closeSubMenu(true);
} else {
state.value = "alive";
}
@@ -160,6 +160,7 @@ const handleActivateA = () => {
}
case "waiting": {
atlas.audio.menuConfirmed.play();
spawn();
break;
}
@@ -207,6 +208,8 @@ const eat = () => {
food.copy(randomFoodPos());
score += 1;
atlas.audio.duplicate.play(0.35);
if (score === 40) {
achievements.unlock("snake_score_25");
}
@@ -214,6 +217,7 @@ const eat = () => {
const die = () => {
state.value = "dead";
atlas.audio.invalid.play();
};
const spawn = () => {
@@ -351,6 +355,7 @@ useKeyDown(({ key }) => {
if (newDirection.clone().dot(direction) === 0) {
nextDirection.copy(newDirection);
atlas.audio.type.play(0.35);
}
});