Repository navigation
Expand file tree
/
Copy pathconfig.js
More file actions
66 lines (58 loc) · 2.32 KB
/
Copy pathconfig.js
File metadata and controls
66 lines (58 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(function () {
// Central tuning values for the board, tray, touch behavior, and saved data.
// Change these values to rebalance the game without editing the game engine.
const CONFIG = {
trayCellSize: 22,
pickupAreaPadding: 18,
// The piece starts above the pointer, then rises farther as the pointer
// travels away from the tray. This keeps the board visible under a finger.
drag: {
baseLiftPx: 100,
maxExtraLiftPx: 180,
maxHorizontalOffsetPx: 170,
extraLiftDistancePx: 360,
// Once a valid position is reached, require this much extra cell travel
// before allowing the piece to move into an invalid position. 0.5 = 50%.
invalidMoveResistance: 0.5,
},
storageKey: "generic-block-game-hex-state-v1",
twoPlayerStorageKey: "generic-block-game-hex-two-player-v1",
aiStorageKey: "generic-block-game-hex-vs-ai-v1",
bestScoreKey: "generic-block-game-hex-best-v1",
modifiedBestScoreKey: "generic-block-game-hex-best-modified-v1",
timedBestScoreKey: "generic-block-game-hex-best-timed-v1",
timedModifiedBestScoreKey: "generic-block-game-hex-best-timed-modified-v1",
settingsKey: "generic-block-game-hex-settings-v1",
globalSettingsKey: "generic-block-game-global-settings-v1",
boardModeKey: "generic-block-game-board-mode-v1",
};
const SQUARE_STORAGE = {
storageKey: "generic-block-game-state-v1",
bestScoreKey: "generic-block-game-best-v1",
modifiedBestScoreKey: "generic-block-game-best-modified-v1",
timedBestScoreKey: "generic-block-game-best-timed-v1",
timedModifiedBestScoreKey: "generic-block-game-best-timed-modified-v1",
settingsKey: "generic-block-game-settings-v1",
};
const APP_VERSION = "0.2";
// Newest version first. The changelog modal lists the entries for APP_VERSION.
const CHANGELOG = [
{
version: "0.2",
changes: [
"New hexagonal game mode!",
"Two Player and VS Ai modes",
"6 new default pieces",
"Better visibility for clearable sections",
],
},
];
function storageKeys(mode = window.GenericBlockGame.getBoardMode?.() || "hex") {
return mode === "square" ? SQUARE_STORAGE : CONFIG;
}
window.GenericBlockGame = window.GenericBlockGame || {};
window.GenericBlockGame.CONFIG = CONFIG;
window.GenericBlockGame.storageKeys = storageKeys;
window.GenericBlockGame.APP_VERSION = APP_VERSION;
window.GenericBlockGame.CHANGELOG = CHANGELOG;
}());