countdown

This commit is contained in:
2026-03-27 01:22:08 +01:00
parent 18d302732c
commit 81c49ed4ae
3 changed files with 28 additions and 22 deletions

36
app.js
View File

@@ -46,25 +46,30 @@ let game = {
}, },
resume: function() { resume: function() {
document.onkeydown = onkeydown pauseSpan.innerHTML = "3"
document.onkeyup = onkeyup setTimeout(() => pauseSpan.innerHTML = "2", 1000)
window.onblur = game.pause setTimeout(() => pauseSpan.innerHTML = "1", 2000)
menu.settings.domElement.onclick = game.pause setTimeout(() => {
document.onkeydown = onkeydown
document.onkeyup = onkeyup
window.onblur = game.pause
menu.settings.domElement.onclick = game.pause
document.body.classList.remove("pause") document.body.classList.remove("pause")
menu.resumeButton.hide() menu.resumeButton.hide()
menu.pauseButton.show() menu.pauseButton.show()
stats.clock.start() stats.clock.start()
stats.clock.elapsedTime = stats.elapsedTime stats.clock.elapsedTime = stats.elapsedTime
if (settings.musicVolume) scene.music.play() if (settings.musicVolume) scene.music.play()
if (scene.playfield.piece) { if (scene.playfield.piece) {
scheduler.resetInterval(game.fall, stats.fallPeriod) scheduler.resetInterval(game.fall, stats.fallPeriod)
} else { } else {
this.generate() this.generate()
} }
}, 3000)
}, },
generate: function(nextPiece=nextQueue.shift()) { generate: function(nextPiece=nextQueue.shift()) {
@@ -122,6 +127,7 @@ let game = {
window.onblur = null window.onblur = null
pauseSpan.onfocus = game.resume pauseSpan.onfocus = game.resume
pauseSpan.innerHTML = "II"
document.body.classList.add("pause") document.body.classList.add("pause")
menu.pauseButton.hide() menu.pauseButton.hide()
menu.resumeButton.show() menu.resumeButton.show()

View File

@@ -28,7 +28,7 @@
</script> </script>
</head> </head>
<body> <body class="pause">
<span id="loadingDiv"> <span id="loadingDiv">
<div class="scene"> <div class="scene">
<div class="T tetromino"> <div class="T tetromino">
@@ -72,7 +72,7 @@
</div> </div>
</span> </span>
<span id="messagesSpan"></span> <span id="messagesSpan"></span>
<span id="pauseSpan" tabindex="1">II</span> <span id="pauseSpan" tabindex="1"></span>
<audio id="music" src="audio/benevolence.m4a" loop></audio> <audio id="music" src="audio/benevolence.m4a" loop></audio>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
<script type="module" src="app.js"></script> <script type="module" src="app.js"></script>

View File

@@ -79,7 +79,7 @@ export class Vortex extends THREE.Group {
loader.load("./images/stars_space.jpg", texture => { loader.load("./images/stars_space.jpg", texture => {
texture.wrapS = THREE.MirroredRepeatWrapping texture.wrapS = THREE.MirroredRepeatWrapping
texture.wrapT = THREE.MirroredRepeatWrapping texture.wrapT = THREE.MirroredRepeatWrapping
texture.repeat.set(4, 8) texture.repeat.set(3, 6)
this.opaqueCylinder.material.map = texture this.opaqueCylinder.material.map = texture
this.opaqueCylinder.material.map.offset.x = 5 this.opaqueCylinder.material.map.offset.x = 5
this.opaqueCylinder.material.blending = THREE.AdditiveBlending this.opaqueCylinder.material.blending = THREE.AdditiveBlending