This commit is contained in:
Adrien MALINGREY 2023-07-04 00:04:47 +02:00
parent 5db16ad50e
commit 73aad137fb

23
app.js
View File

@ -132,6 +132,11 @@ class Scheduler {
class Matrix extends THREE.Group { class Matrix extends THREE.Group {
constructor() {
super()
this.init()
}
init() { init() {
this.cells = Array(ROWS).fill().map(() => Array(COLUMNS)) this.cells = Array(ROWS).fill().map(() => Array(COLUMNS))
this.unlockedMinoes = new Set() this.unlockedMinoes = new Set()
@ -967,10 +972,13 @@ messagesSpan.onanimationend = function (event) {
let piece = null let piece = null
let game = { let game = {
init: function() { playing: false,
this.playing = false
start: function() {
startButton.hide()
stats.init() stats.init()
stats.gui.show()
settings.gui.close()
holdQueue.remove(holdQueue.piece) holdQueue.remove(holdQueue.piece)
holdQueue.piece = null holdQueue.piece = null
@ -981,13 +989,6 @@ let game = {
piece = null piece = null
scene.remove(ghost) scene.remove(ghost)
music.currentTime = 0 music.currentTime = 0
},
start: function() {
startButton.hide()
stats.gui.show()
settings.gui.close()
edge.visible = true edge.visible = true
this.playing = true this.playing = true
@ -1089,6 +1090,8 @@ let game = {
stats.clock.stop() stats.clock.stop()
localStorage["teTraHighScore"] = stats.highScore localStorage["teTraHighScore"] = stats.highScore
messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>GAME<br/>OVER</h1>` }) messagesSpan.addNewChild("div", { className: "show-level-animation", innerHTML: `<h1>GAME<br/>OVER</h1>` })
startButton.show()
}, },
} }
@ -1194,8 +1197,6 @@ if (debug) {
}) })
} }
game.init()
// Handle player inputs // Handle player inputs
const REPEATABLE_ACTIONS = [ const REPEATABLE_ACTIONS = [
playerActions.moveLeft, playerActions.moveLeft,