diff --git a/app.js b/app.js index c79ec98..b47fb31 100644 --- a/app.js +++ b/app.js @@ -135,7 +135,7 @@ let game = { window.onblur = null renderer.domElement.onfocus = null menu.settings.domElement.onfocus = null - game.playing = false + this.playing = false scene.music.pause() stats.clock.stop() messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `

GAME
OVER

` }) @@ -347,5 +347,5 @@ window.addEventListener("resize", () => { window.onbeforeunload = function (event) { menu.save() localStorage["teTraHighScore"] = stats.highScore - return !game.playing + if (game.playing) return false; } \ No newline at end of file diff --git a/jsm/TetraScene.js b/jsm/TetraScene.js index 8222388..c359fe9 100644 --- a/jsm/TetraScene.js +++ b/jsm/TetraScene.js @@ -47,8 +47,8 @@ export class TetraScene extends THREE.Scene { set theme(theme) { switch (theme) { case "Plasma": - this.ambientLight.intensity = 0.6 - this.directionalLight.intensity = 11 + this.ambientLight.intensity = 0 + this.directionalLight.intensity = 1.75 this.directionalLight.position.set(5, -20, 20) break case "Espace": diff --git a/jsm/Tetrominoes.js b/jsm/Tetrominoes.js index 000cb81..dc2d6af 100644 --- a/jsm/Tetrominoes.js +++ b/jsm/Tetrominoes.js @@ -75,23 +75,6 @@ export class InstancedMino extends THREE.InstancedMesh { const roundedBoxGeometry = new RoundedBoxGeometry(1.03, 1.03, 1.03, 4, 0.15) roundedBoxGeometry.translate(0.5, 0.5, 0) super(roundedBoxGeometry, undefined, 2*ROWS*COLUMNS) - this.roundedBoxGeometry = roundedBoxGeometry - let minoFaceShape = new THREE.Shape() - minoFaceShape.moveTo(.1, .1) - minoFaceShape.lineTo(.1, .9) - minoFaceShape.lineTo(.9, .9) - minoFaceShape.lineTo(.9, .1) - minoFaceShape.lineTo(.1, .1) - let minoExtrudeSettings = { - steps: 1, - depth: .8, - bevelEnabled: true, - bevelThickness: .1, - bevelSize: .1, - bevelOffset: 0, - bevelSegments: 1 - } - this.extrudeGeometry = new THREE.ExtrudeGeometry(minoFaceShape, minoExtrudeSettings) this.offsets = new Uint8Array(2*this.count) } @@ -99,14 +82,14 @@ export class InstancedMino extends THREE.InstancedMesh { if (theme == "Rétro") { this.resetColor() this.update = this.updateOffset - this.geometry = this.extrudeGeometry if (this.materials["Rétro"]) { this.material = this.materials["Rétro"] } else { this.materials["Rétro"] = [] const loadingManager = new THREE.LoadingManager(() => this.material = this.materials["Rétro"]) new THREE.TextureLoader(loadingManager).load("images/sprites.png", (texture) => { - this.materials.Rétro[0] = this.materials.Rétro[2] = new TileMaterial({ + this.materials.Rétro[4] = + this.materials.Rétro[5] = new TileMaterial({ color: COLORS.RETRO, map: texture, bumpMap: texture, @@ -117,7 +100,10 @@ export class InstancedMino extends THREE.InstancedMesh { }, 8, 8) }) new THREE.TextureLoader(loadingManager).load("images/edges.png", (texture) => { - this.materials.Rétro[1] = this.materials.Rétro[3] = this.materials.Rétro[4] = this.materials.Rétro[5] = new TileMaterial({ + this.materials.Rétro[0] = + this.materials.Rétro[1] = + this.materials.Rétro[2] = + this.materials.Rétro[3] = new TileMaterial({ color: COLORS.RETRO, map: texture, bumpMap: texture, @@ -129,7 +115,6 @@ export class InstancedMino extends THREE.InstancedMesh { }) } } else { - this.geometry = this.roundedBoxGeometry this.update = this.updateColor this.material = this.materials[theme] } diff --git a/jsm/Vortex.js b/jsm/Vortex.js index dd2da80..28e4d75 100644 --- a/jsm/Vortex.js +++ b/jsm/Vortex.js @@ -47,7 +47,7 @@ export class Vortex extends THREE.Group { texture.repeat.set(1, 2) this.darkCylinder.material.map = texture }) - this.darkCylinder.material.opacity = 0.05 + this.darkCylinder.material.opacity = 0.14 new THREE.TextureLoader(this.loadingManager).load("./images/plasma2.jpg", texture => { texture.wrapS = THREE.RepeatWrapping @@ -55,7 +55,7 @@ export class Vortex extends THREE.Group { texture.repeat.set(2, 2) this.colorFullCylinder.material.map = texture }) - this.colorFullCylinder.material.opacity = 0.8 + this.colorFullCylinder.material.opacity = 0.6 this.globalRotation = 0.028 this.darkTextureRotation = 0.005