resume on pause key down
This commit is contained in:
parent
b34a968dd2
commit
e1da884441
11
app.js
11
app.js
@ -117,7 +117,8 @@ let game = {
|
|||||||
scheduler.clearInterval(autorepeat)
|
scheduler.clearInterval(autorepeat)
|
||||||
|
|
||||||
scene.music.pause()
|
scene.music.pause()
|
||||||
document.onkeydown = null
|
document.onkeydown = resumeOnKeyDown
|
||||||
|
document.onkeyup = null
|
||||||
window.onblur = null
|
window.onblur = null
|
||||||
|
|
||||||
pauseSpan.onfocus = game.resume
|
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 */
|
/* Scene */
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ export class TetraGUI extends GUI {
|
|||||||
})
|
})
|
||||||
loadingManager.onLoad = function() {
|
loadingManager.onLoad = function() {
|
||||||
scene.vortex.darkCylinder.material.map = darkTexture
|
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.map = colorfullTexture
|
||||||
scene.vortex.colorFullCylinder.material.opacity = 0.7
|
scene.vortex.colorFullCylinder.material.opacity = 0.7
|
||||||
|
|
||||||
@ -120,7 +120,8 @@ export class TetraGUI extends GUI {
|
|||||||
scene.hardDropSound.setVolume(volume/100)
|
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 dev = this.addFolder("dev")
|
||||||
let cameraPosition = dev.addFolder("camera.position").close()
|
let cameraPosition = dev.addFolder("camera.position").close()
|
||||||
cameraPosition.add(scene.camera.position, "x")
|
cameraPosition.add(scene.camera.position, "x")
|
||||||
|
@ -27,7 +27,7 @@ export class Vortex extends THREE.Group {
|
|||||||
texture.repeat.set(1, 1)
|
texture.repeat.set(1, 1)
|
||||||
}),
|
}),
|
||||||
blending: THREE.AdditiveBlending,
|
blending: THREE.AdditiveBlending,
|
||||||
opacity: 0.03
|
opacity: 0.055
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
this.add(this.darkCylinder)
|
this.add(this.darkCylinder)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user