-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
196 lines (183 loc) · 11.2 KB
/
Copy pathindex.html
File metadata and controls
196 lines (183 loc) · 11.2 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta name="theme-color" content="#000000">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<title>The Falling Grid</title>
<meta name="description" content="The Falling Grid — place blocks, clear lines, and beat the clock in this browser puzzle game.">
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%230a84ff'/%3E%3Crect x='6' y='6' width='9' height='9' rx='2' fill='white' opacity='.9'/%3E%3Crect x='17' y='6' width='9' height='9' rx='2' fill='white' opacity='.45'/%3E%3Crect x='6' y='17' width='9' height='9' rx='2' fill='white' opacity='.45'/%3E%3Crect x='17' y='17' width='9' height='9' rx='2' fill='white' opacity='.75'/%3E%3C/svg%3E">
<link rel="stylesheet" href="style.css">
</head>
<body>
<noscript>
<p class="noscript">The Falling Grid requires JavaScript. Please enable it to play.</p>
</noscript>
<div class="page-bg" aria-hidden="true"></div>
<main class="app">
<header class="header">
<div class="header__brand">
<div class="header__mark" aria-hidden="true">
<svg width="28" height="28" viewBox="0 0 28 28" fill="none">
<rect x="4" y="4" width="8" height="8" rx="2" fill="currentColor" opacity="0.9"/>
<rect x="16" y="4" width="8" height="8" rx="2" fill="currentColor" opacity="0.5"/>
<rect x="4" y="16" width="8" height="8" rx="2" fill="currentColor" opacity="0.5"/>
<rect x="16" y="16" width="8" height="8" rx="2" fill="currentColor"/>
</svg>
</div>
<div>
<h1>The Falling Grid</h1>
<span>Block puzzle</span>
</div>
</div>
<div class="header__scores" aria-live="polite" aria-atomic="true">
<div class="score-block" id="score-block-current">
<span class="label">Score</span>
<span class="value" id="current-score">0</span>
</div>
<div class="score-block score-block--dim" id="score-block-best">
<span class="label">Best</span>
<span class="value" id="high-score">0</span>
</div>
</div>
<div class="header__actions">
<button id="btn-pause" class="icon-btn" type="button" aria-label="Pause">
<svg width="18" height="18" viewBox="0 0 18 18" fill="currentColor" aria-hidden="true"><rect x="3" y="2" width="4" height="14" rx="1"/><rect x="11" y="2" width="4" height="14" rx="1"/></svg>
</button>
<button id="btn-info" class="icon-btn" type="button" aria-label="Help">
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><circle cx="9" cy="9" r="7"/><path d="M9 8v5M9 5.5v.5" stroke-linecap="round"/></svg>
</button>
<button id="btn-sound" class="icon-btn" type="button" aria-label="Sound on">
<svg id="sound-icon-on" class="icon-btn__glyph" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7v4h3l4 3V4L6 7H3z"/><path d="M12 6.5a4 4 0 010 5M14 4.5a7 7 0 010 9" stroke-linecap="round"/></svg>
<svg id="sound-icon-off" class="icon-btn__glyph hidden" width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true"><path d="M3 7v4h3l4 3V4L6 7H3z"/><path d="M14 5l-8 8M6 5l8 8" stroke-linecap="round"/></svg>
</button>
</div>
</header>
<section class="metrics" aria-label="Session stats">
<article class="metric metric--hero">
<div class="metric__row">
<span class="label" id="time-status-text">Time remaining</span>
<strong class="metric__hero-value" id="time-remaining-text">300s</strong>
</div>
<div class="bar bar--hero"><div class="bar__fill" id="game-timer-bar"></div></div>
</article>
<article class="metric metric--compact" id="shift-metric" aria-label="Seconds until the board rotates">
<span class="label">Rotates in</span>
<strong class="metric__value" id="gravity-countdown">30s</strong>
<span class="metric__sub" id="gravity-dir-box">
<svg class="rotate-arrow clockwise" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M21 12a9 9 0 1 1-2.2-6M21 3v5h-5"/></svg>
<svg class="rotate-arrow counter-clockwise hidden" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M3 12a9 9 0 1 0 2.2-6M3 3v5h5"/></svg>
</span>
</article>
<article class="metric metric--compact metric--level">
<div class="metric__row">
<span class="label">Level <strong id="player-level">1</strong></span>
<span class="level-xp" id="level-xp-text">0%</span>
</div>
<div class="bar bar--thin"><div class="bar__fill bar__fill--accent" id="level-progress-bar"></div></div>
<span class="level-bonus" id="level-bonus-text">+0% score</span>
</article>
</section>
<section class="board-wrap" id="board-frame-container" aria-label="Game board">
<canvas id="particle-canvas" aria-hidden="true"></canvas>
<div class="board-grid" id="board" role="grid"></div>
</section>
<section class="tray" aria-label="Pieces and tools">
<div class="tray__meta">
<span>3 pieces · tap to rotate</span>
<span class="tray__cost">−3s per placement</span>
</div>
<div class="pieces-shelf" id="pieces-shelf"></div>
<div class="tray__tools">
<div class="hold">
<div class="hold-slot" id="hold-slot" title="Held piece"></div>
<button id="btn-hold" class="chip" type="button">Hold</button>
</div>
<button id="btn-undo" class="chip" type="button">Undo <span class="chip__cost">500</span></button>
<button id="btn-freeze" class="chip" type="button">Freeze <span class="chip__cost">1000</span></button>
</div>
</section>
<p class="streak-line">Streak <strong id="streak-count">0</strong> · single-color line = 2× points</p>
<footer class="game-footer">
<p>Built by Jst Tan, playable on any browser</p>
</footer>
</main>
<div class="event-popup" id="event-popup" aria-live="assertive" hidden>
<div class="event-popup__card" id="event-popup-card">
<div class="event-popup__icon" id="event-popup-icon" aria-hidden="true"></div>
<h3 id="event-popup-title"></h3>
<p id="event-popup-msg"></p>
<p class="event-popup__bonus" id="event-popup-bonus"></p>
<button type="button" class="btn btn--primary" id="event-popup-continue">Continue</button>
</div>
</div>
<div class="modal active" id="modal-intro" role="dialog" aria-modal="true" aria-labelledby="intro-title">
<div class="modal__sheet">
<div class="modal__handle" aria-hidden="true"></div>
<div class="modal__hero">
<div class="modal__logo" aria-hidden="true">
<svg width="48" height="48" viewBox="0 0 48 48" fill="none">
<rect x="6" y="6" width="14" height="14" rx="4" fill="currentColor"/>
<rect x="28" y="6" width="14" height="14" rx="4" fill="currentColor" opacity="0.45"/>
<rect x="6" y="28" width="14" height="14" rx="4" fill="currentColor" opacity="0.45"/>
<rect x="28" y="28" width="14" height="14" rx="4" fill="currentColor" opacity="0.75"/>
</svg>
</div>
<h2 id="intro-title">The Falling Grid</h2>
<p class="modal__tagline">Place blocks. Clear lines. The board turns. Time falls.</p>
</div>
<div class="rules">
<article class="rule">
<h3 class="rule__title">Play</h3>
<p class="rule__text">Drag 3 pieces onto the 8×8 grid. Clear full rows or columns.</p>
</article>
<article class="rule">
<h3 class="rule__title">Falling blocks</h3>
<p class="rule__text">Blocks fall after every move. Every 30s the board rotates — tap continue, then it spins.</p>
</article>
<article class="rule">
<h3 class="rule__title">Chroma</h3>
<p class="rule__text">Clear a line in one color only for double points.</p>
</article>
<article class="rule">
<h3 class="rule__title">Level up</h3>
<p class="rule__text">Every 1,000 score: more points per move, slightly faster clock.</p>
</article>
</div>
<button id="btn-start" class="btn btn--primary btn--block" type="button">Start playing</button>
</div>
</div>
<div class="modal" id="modal-paused" role="dialog" aria-modal="true">
<div class="modal__sheet modal__sheet--compact">
<h2 class="modal__title-center">Paused</h2>
<p class="modal__subtitle">Take a breath — your timer is stopped.</p>
<button id="btn-resume" class="btn btn--primary btn--block" type="button">Resume</button>
</div>
</div>
<div class="modal" id="modal-gameover" role="dialog" aria-modal="true">
<div class="modal__sheet modal__sheet--compact">
<h2 class="modal__title-center">Session ended</h2>
<p class="badge-new-best hidden" id="new-best-badge">New personal best</p>
<p class="modal__reason" id="gameover-reason"></p>
<div class="results">
<div class="result-card">
<span>Score</span>
<strong id="final-score">0</strong>
</div>
<div class="result-card">
<span>Level</span>
<strong id="final-level">1</strong>
</div>
<div class="result-card">
<span>Chroma</span>
<strong id="final-chromas">0</strong>
</div>
</div>
<button id="btn-restart" class="btn btn--primary btn--block" type="button">Play again</button>
</div>
</div>
<script src="game.js"></script>
</body>
</html>