Skip to content

Commit 6dbf8d0

Browse files
committed
added faster drop speed for tetris
1 parent 4dc0b78 commit 6dbf8d0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

components/gtag.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>
33
<script>
44
window.ccPorted = {
5-
version: "2024-12-05T20:05:11.136Z"
5+
version: "2024-12-06T15:49:24.944Z"
66
};
77
const SUPABASE_URL = 'https://dahljrdecyiwfjgklnvz.supabase.co';
88
const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRhaGxqcmRlY3lpd2ZqZ2tsbnZ6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjgyNjE3NzMsImV4cCI6MjA0MzgzNzc3M30.8-YlXqSXsYoPTaDlHMpTdqLxfvm89-8zk2HG2MCABRI';

static/t/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h2>Controls</h2>
3232
</div>
3333
</div>
3434

35-
<script src = "tetris.js?i=2"></script>
35+
<script src = "tetris.js?i=3"></script>
3636
</body>
3737

3838
</html>

static/t/tetris.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,14 @@ try {
259259
this.drop();
260260
this.dropCounter = 0;
261261
}
262-
262+
this.dropInterval = Math.max(1000 - this.calculateLevel() * 100, 250);
263263
this.draw();
264264
requestAnimationFrame(this.update.bind(this));
265265
}
266266
}
267-
267+
calculateLevel() {
268+
return Math.floor(this.score / 500);
269+
}
268270
draw() {
269271
// Clear canvas
270272
ctx.fillStyle = '#000';

0 commit comments

Comments
 (0)