mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-22 04:56:15 -04:00
Build 29068563
This commit is contained in:
parent
6ef13f2d19
commit
df8bfbb350
25 changed files with 384 additions and 336 deletions
25
src/addToTotalScore.ts
Normal file
25
src/addToTotalScore.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { GameState } from "./types";
|
||||
import { icons, upgrades } from "./loadGameData";
|
||||
import { schedulGameSound } from "./gameStateMutators";
|
||||
import { toast } from "./toast";
|
||||
import { t } from "./i18n/i18n";
|
||||
import { getTotalScore, setSettingValue } from "./settings";
|
||||
|
||||
export function addToTotalScore(gameState: GameState, points: number) {
|
||||
if (gameState.creative) return;
|
||||
const pastScore = getTotalScore();
|
||||
const newScore = pastScore + points;
|
||||
setSettingValue("breakout_71_total_score", newScore);
|
||||
// Check unlocked upgrades
|
||||
upgrades.forEach((u) => {
|
||||
if (u.threshold > pastScore && u.threshold <= newScore) {
|
||||
schedulGameSound(gameState, "colorChange", 0, 1);
|
||||
toast(
|
||||
icons["icon:" + u.id] +
|
||||
"<strong>" +
|
||||
t("gameOver.unlocked_perk") +
|
||||
"</strong>",
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue