resume on pause key down

This commit is contained in:
Adrien MALINGREY 2023-07-20 19:35:13 +02:00
parent b34a968dd2
commit e1da884441
3 changed files with 14 additions and 4 deletions

11
app.js
View File

@ -117,7 +117,8 @@ let game = {
scheduler.clearInterval(autorepeat)
scene.music.pause()
document.onkeydown = null
document.onkeydown = resumeOnKeyDown
document.onkeyup = null
window.onblur = null
pauseSpan.onfocus = game.resume
@ -244,6 +245,14 @@ function onkeyup(event) {
}
}
function resumeOnKeyDown(event) {
let key = event.key
if(playerActions[settings.action[key]] == playerActions.pause) {
event.preventDefault()
game.resume()
}
}
/* Scene */

View File

@ -44,7 +44,7 @@ export class TetraGUI extends GUI {
})
loadingManager.onLoad = function() {
scene.vortex.darkCylinder.material.map = darkTexture
scene.vortex.darkCylinder.material.opacity = 0.03
scene.vortex.darkCylinder.material.opacity = 0.055
scene.vortex.colorFullCylinder.material.map = colorfullTexture
scene.vortex.colorFullCylinder.material.opacity = 0.7
@ -120,7 +120,8 @@ export class TetraGUI extends GUI {
scene.hardDropSound.setVolume(volume/100)
})
if (window.location.search.includes("dev")) {
this.dev = window.location.search.includes("dev")
if (this.dev) {
let dev = this.addFolder("dev")
let cameraPosition = dev.addFolder("camera.position").close()
cameraPosition.add(scene.camera.position, "x")

View File

@ -27,7 +27,7 @@ export class Vortex extends THREE.Group {
texture.repeat.set(1, 1)
}),
blending: THREE.AdditiveBlending,
opacity: 0.03
opacity: 0.055
})
)
this.add(this.darkCylinder)