message timeouts
This commit is contained in:
parent
69ced39496
commit
7853b82a4e
17
src/Game.vue
17
src/Game.vue
@ -97,7 +97,8 @@ function completeRow() {
|
|||||||
showMessage(
|
showMessage(
|
||||||
['Genius', 'Magnificent', 'Impressive', 'Splendid', 'Great', 'Phew'][
|
['Genius', 'Magnificent', 'Impressive', 'Splendid', 'Great', 'Phew'][
|
||||||
currentRowIndex
|
currentRowIndex
|
||||||
]
|
],
|
||||||
|
2000
|
||||||
)
|
)
|
||||||
} else if (currentRowIndex < board.length - 1) {
|
} else if (currentRowIndex < board.length - 1) {
|
||||||
// go the next row
|
// go the next row
|
||||||
@ -105,7 +106,7 @@ function completeRow() {
|
|||||||
} else {
|
} else {
|
||||||
// game over :(
|
// game over :(
|
||||||
allowInput = false
|
allowInput = false
|
||||||
showMessage(answer.toUpperCase())
|
showMessage(answer.toUpperCase(), -1)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shake()
|
shake()
|
||||||
@ -113,11 +114,13 @@ function completeRow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMessage(msg: string) {
|
function showMessage(msg: string, time = 1000) {
|
||||||
message = msg
|
message = msg
|
||||||
setTimeout(() => {
|
if (time > 0) {
|
||||||
message = ''
|
setTimeout(() => {
|
||||||
}, 1000)
|
message = ''
|
||||||
|
}, time)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function shake() {
|
function shake() {
|
||||||
@ -234,7 +237,7 @@ function shake() {
|
|||||||
}
|
}
|
||||||
.tile.filled .front {
|
.tile.filled .front {
|
||||||
border-color: #999;
|
border-color: #999;
|
||||||
animation: zoom .2s;
|
animation: zoom 0.2s;
|
||||||
}
|
}
|
||||||
.tile:not(.empty) {
|
.tile:not(.empty) {
|
||||||
border: none;
|
border: none;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user