2021-07-04 21:37:21 +03:00
|
|
|
// функции игры
|
|
|
|
|
2021-07-06 05:27:07 +03:00
|
|
|
export function loadingLogo(imagesArray) {
|
|
|
|
// FIXME: возможно потом просто удалить функцию, если будет реализован imageLoader
|
|
|
|
let imgLogo = new Image();
|
|
|
|
imgLogo.src = 'assets/logo.png';
|
|
|
|
|
|
|
|
imagesArray.logo = imgLogo;
|
|
|
|
}
|
|
|
|
|
2021-07-06 04:09:59 +03:00
|
|
|
export function checkAnswer(quest, answer) {
|
|
|
|
if (quest.rightAnswer.toLowerCase() == answer.toLowerCase()) {
|
|
|
|
quest.status = true;
|
2021-07-04 23:24:27 +03:00
|
|
|
}
|
2021-07-04 21:37:21 +03:00
|
|
|
else
|
2021-07-06 04:09:59 +03:00
|
|
|
quest.status = false;
|
2021-07-04 22:12:04 +03:00
|
|
|
}
|
2021-07-04 23:07:38 +03:00
|
|
|
|
2021-07-06 05:27:07 +03:00
|
|
|
export function shuffle(array) {
|
|
|
|
for (let i = array.length - 1; i > 0; i--) {
|
2021-07-04 23:07:38 +03:00
|
|
|
const j = Math.floor(Math.random() * (i + 1));
|
2021-07-06 05:27:07 +03:00
|
|
|
[array[i], array[j]] = [array[j], array[i]];
|
2021-07-04 23:07:38 +03:00
|
|
|
}
|
|
|
|
}
|