fix scoreSpan
This commit is contained in:
parent
e0290a4918
commit
46237fb01c
37
app.js
37
app.js
@ -466,17 +466,37 @@ class Stats {
|
||||
lockDown(nbClearedLines, tSpin) {
|
||||
// Cleared lines & T-Spin
|
||||
let patternScore = SCORES[tSpin][nbClearedLines] * this.level
|
||||
if (tSpin) scoreSpan.innerHTML += `<div class="rotate-in-animation">${tSpin}</div>\n`
|
||||
if (nbClearedLines) scoreSpan.innerHTML += `<div class="zoom-in-animation">${CLEARED_LINES_NAMES[nbClearedLines]}</div>\n`
|
||||
if (patternScore) scoreSpan.innerHTML += `<div class="zoom-in-animation">${patternScore}</div>\n`
|
||||
this.score += patternScore
|
||||
if (tSpin) {
|
||||
let div = document.createElement("div")
|
||||
div.className = "rotate-in-animation"
|
||||
div.innerHTML = tSpin
|
||||
scoreSpan.appendChild(div)
|
||||
}
|
||||
if (nbClearedLines) {
|
||||
let div = document.createElement("div")
|
||||
div.className = "zoom-in-animation"
|
||||
div.innerHTML = CLEARED_LINES_NAMES[nbClearedLines]
|
||||
scoreSpan.appendChild(div)
|
||||
}
|
||||
if (patternScore) {
|
||||
let div = document.createElement("div")
|
||||
div.className = "zoom-in-animation"
|
||||
div.style = "animation-delay: .2s"
|
||||
div.innerHTML = patternScore
|
||||
scoreSpan.appendChild(div)
|
||||
this.score += patternScore
|
||||
}
|
||||
|
||||
// Combo
|
||||
if (nbClearedLines) {
|
||||
this.combo++
|
||||
if (this.combo >= 1) {
|
||||
let comboScore = (nbClearedLines == 1 ? 20 : 50) * this.combo * this.level
|
||||
scoreSpan.innerHTML += `<div class="zoom-in-animation">COMBO x${this.combo}<br/>${comboScore}</div>\n`
|
||||
let div = document.createElement("div")
|
||||
div.className = "zoom-in-animation"
|
||||
div.style = "animation-delay: .4s"
|
||||
div.innerHTML = `COMBO x${this.combo}<br/>${comboScore}`
|
||||
scoreSpan.appendChild(div)
|
||||
this.score += comboScore
|
||||
}
|
||||
} else {
|
||||
@ -488,7 +508,11 @@ class Stats {
|
||||
this.b2b++
|
||||
if (this.b2b >= 1) {
|
||||
let b2bScore = patternScore / 2
|
||||
scoreSpan.innerHTML += `<div class="zoom-in-animation">BACK TO BACK x${this.b2b}<br/>${b2bScore}</div>\n`
|
||||
let div = document.createElement("div")
|
||||
div.className = "zoom-in-animation"
|
||||
div.style = "animation-delay: .4s"
|
||||
div.innerHTML = `BACK TO BACK x${this.b2b}<br/>${b2bScore}`
|
||||
scoreSpan.appendChild(div)
|
||||
this.score += b2bScore
|
||||
}
|
||||
} else if ((0 < nbClearedLines) && (nbClearedLines < 4) && !tSpin) {
|
||||
@ -507,7 +531,6 @@ onanimationend = function (event) {
|
||||
}
|
||||
|
||||
scoreSpan.onanimationend = function(event) {
|
||||
console.log(event)
|
||||
event.target.remove()
|
||||
}
|
||||
|
||||
|
@ -175,31 +175,4 @@ span {
|
||||
animation-timing-function: cubic-bezier(.25,.46,.45,.94);
|
||||
transform-origin:center;
|
||||
animation-duration: 1s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(2) {
|
||||
animation-delay: .2s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(3) {
|
||||
animation-delay: .4s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(4) {
|
||||
animation-delay: .6s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(5) {
|
||||
animation-delay: .8s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(6) {
|
||||
animation-delay: 1s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(7) {
|
||||
animation-delay: 1.2s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(8) {
|
||||
animation-delay: 1.4s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(9) {
|
||||
animation-delay: 1.6s;
|
||||
}
|
||||
#scoreSpan div.zoom-in-animation:nth-child(10) {
|
||||
animation-delay: 1.8s;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user