User prompt
Add background as assets
User prompt
add background
User prompt
add a voice when you get it wrong
User prompt
let there be a sound every time you know
User prompt
Ask 10 questions, not 30
User prompt
take it back
User prompt
50 questions instead of 30
User prompt
or let confetti explode instead of fire
User prompt
add a fire radiating from the bottom of the screen every time you get it right
User prompt
add chill game song
User prompt
don't count the score, when you get it wrong, it's game over
Code edit (1 edits merged)
Please save this source code
User prompt
Quiz Blitz: 10-Second Trivia
Initial prompt
I want to make a simple trivia game where the player is asked one question per round and shown 4 multiple choice options. The player gets 1 point for choosing the correct answer. The game will consist of 10 questions in total. The questions can be on fun and simple topics like emoji interpretation, flag recognition, which animal is heavier. Each question will have only one correct answer. The interface should be simple and easy to play on mobile devices. write 30 questions in total, choose from them and ask them randomly
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // --- Optional: Allow restart on game over (handled by LK) --- // --- Touchscreen compatibility: all controls are via .down events on buttons --- // --- No music, sound, or pause --- // --- No elements in top left 100x100 px (all UI is top, topRight, or center) --- // --- No background art, just clean white --- // --- All elements are visible and centered for mobile --- // --- No keyboard controls --- // --- No dynamic resizing code needed --- // --- MVP complete --- // ConfettiBurst: A visual effect of confetti exploding from the bottom of the screen var ConfettiBurst = Container.expand(function () { var self = Container.call(this); // Number of confetti pieces var pieces = 32 + Math.floor(Math.random() * 12); // 32-43 pieces var centerX = 2048 / 2; var baseY = 2732 - 60; // 60px from bottom var minLen = 600, maxLen = 1200; var minSize = 40, maxSize = 80; var colors = [0xff5e5e, 0x5ecbff, 0xffe15e, 0x7cff5e, 0xb95eff, 0xff5edb, 0x5effb9, 0xffffff]; for (var i = 0; i < pieces; i++) { var angle = -Math.PI / 2 + (Math.random() - 0.5) * Math.PI * 0.9; // -80deg to +80deg var len = minLen + Math.random() * (maxLen - minLen); var size = minSize + Math.random() * (maxSize - minSize); var color = colors[Math.floor(Math.random() * colors.length)]; var conf = self.attachAsset('confetti' + i, { width: size * (0.7 + Math.random() * 0.6), height: size * (0.7 + Math.random() * 0.6), color: color, shape: 'box', anchorX: 0.5, anchorY: 1 }); conf.x = centerX + (Math.random() - 0.5) * 200; conf.y = baseY; conf.rotation = angle + (Math.random() - 0.5) * 0.5; conf.alpha = 0.85 + Math.random() * 0.15; // Animate: move out, rotate, fall, and fade (function (confetti, angle, len) { var targetX = confetti.x + Math.cos(angle) * len; var targetY = confetti.y + Math.sin(angle) * len + 200 + Math.random() * 200; var rot = confetti.rotation + (Math.random() - 0.5) * 2.5; tween(confetti, { x: targetX, y: targetY, rotation: rot, alpha: 0 }, { duration: 900 + Math.random() * 200, easing: tween.easeOut, onComplete: function onComplete() { if (confetti.parent) confetti.parent.removeChild(confetti); } }); })(conf, angle, len); } // Remove the whole effect after animation LK.setTimeout(function () { if (self.parent) self.parent.removeChild(self); }, 1200); return self; }); /**** * Initialize Game ****/ // No custom classes needed for MVP, as all elements are UI and static. var game = new LK.Game({ backgroundColor: 0x87ceeb // Sky blue background for a friendly quiz look }); /**** * Game Code ****/ // Background image asset (2048x2732, covers full game area) // --- Add background image --- var backgroundImg = LK.getAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0, width: 2048, height: 2732 }); game.addChild(backgroundImg); // --- Question Pool --- // Initialize chill background music asset var questionPool = [ // Emoji { q: "What does the 🦄 emoji represent?", choices: ["Unicorn", "Horse", "Rhino", "Dragon"], answer: 0 }, { q: "What does the 😂 emoji mean?", choices: ["Crying", "Laughing with tears", "Angry", "Surprised"], answer: 1 }, { q: "What does the 🍕 emoji represent?", choices: ["Cake", "Pizza", "Sandwich", "Pie"], answer: 1 }, { q: "What does the 🦁 emoji represent?", choices: ["Tiger", "Lion", "Bear", "Dog"], answer: 1 }, { q: "What does the 🐧 emoji represent?", choices: ["Penguin", "Duck", "Chicken", "Ostrich"], answer: 0 }, { q: "What does the 🥑 emoji represent?", choices: ["Avocado", "Pear", "Apple", "Kiwi"], answer: 0 }, { q: "What does the 🦋 emoji represent?", choices: ["Bee", "Butterfly", "Moth", "Dragonfly"], answer: 1 }, { q: "What does the 🏀 emoji represent?", choices: ["Soccer", "Basketball", "Tennis", "Baseball"], answer: 1 }, { q: "What does the 🏰 emoji represent?", choices: ["Palace", "Castle", "Hotel", "Temple"], answer: 1 }, { q: "What does the 🦒 emoji represent?", choices: ["Camel", "Giraffe", "Horse", "Deer"], answer: 1 }, // Flags { q: "Which country does this flag 🇯🇵 belong to?", choices: ["China", "Japan", "South Korea", "Vietnam"], answer: 1 }, { q: "Which country does this flag 🇧🇷 belong to?", choices: ["Argentina", "Brazil", "Mexico", "Colombia"], answer: 1 }, { q: "Which country does this flag 🇨🇦 belong to?", choices: ["USA", "Canada", "UK", "Australia"], answer: 1 }, { q: "Which country does this flag 🇫🇷 belong to?", choices: ["Italy", "France", "Netherlands", "Russia"], answer: 1 }, { q: "Which country does this flag 🇮🇳 belong to?", choices: ["Pakistan", "India", "Bangladesh", "Nepal"], answer: 1 }, { q: "Which country does this flag 🇦🇺 belong to?", choices: ["New Zealand", "Australia", "UK", "USA"], answer: 1 }, { q: "Which country does this flag 🇩🇪 belong to?", choices: ["Belgium", "Germany", "Austria", "Switzerland"], answer: 1 }, { q: "Which country does this flag 🇪🇬 belong to?", choices: ["Egypt", "Morocco", "Turkey", "Greece"], answer: 0 }, { q: "Which country does this flag 🇮🇹 belong to?", choices: ["Ireland", "Italy", "Mexico", "Hungary"], answer: 1 }, { q: "Which country does this flag 🇪🇸 belong to?", choices: ["Portugal", "Spain", "France", "Chile"], answer: 1 }, // Animal Facts { q: "Which animal is the largest land animal?", choices: ["Elephant", "Giraffe", "Rhino", "Hippo"], answer: 0 }, { q: "Which animal is known for changing its color?", choices: ["Chameleon", "Frog", "Snake", "Lizard"], answer: 0 }, { q: "Which animal is the fastest on land?", choices: ["Cheetah", "Lion", "Horse", "Kangaroo"], answer: 0 }, { q: "Which animal can fly backwards?", choices: ["Hummingbird", "Eagle", "Bat", "Sparrow"], answer: 0 }, { q: "Which animal is known as the king of the jungle?", choices: ["Lion", "Tiger", "Bear", "Wolf"], answer: 0 }, { q: "Which animal sleeps standing up?", choices: ["Horse", "Dog", "Cat", "Rabbit"], answer: 0 }, { q: "Which animal has black and white stripes?", choices: ["Zebra", "Tiger", "Panda", "Skunk"], answer: 0 }, { q: "Which animal is the tallest in the world?", choices: ["Giraffe", "Elephant", "Camel", "Ostrich"], answer: 0 }, { q: "Which animal is famous for its memory?", choices: ["Elephant", "Dog", "Cat", "Dolphin"], answer: 0 }, { q: "Which animal is a marsupial?", choices: ["Kangaroo", "Horse", "Cow", "Sheep"], answer: 0 }]; // --- Game State --- var questions = []; // The 30 questions for this round var currentQuestion = 0; var score = 0; var answerButtons = []; var questionText = null; var scoreText = null; var progressText = null; var canAnswer = true; // --- Utility: Shuffle and pick N --- function pickRandomQuestions(pool, n) { var arr = []; var used = []; var len = pool.length; for (var i = 0; i < n; i++) { var idx; do { idx = Math.floor(Math.random() * len); } while (used.indexOf(idx) !== -1); used.push(idx); arr.push(pool[idx]); } return arr; } // --- UI Setup --- // Score display (top right, away from top left menu) scoreText = new Text2("Score: 0", { size: 80, fill: 0x222222 }); scoreText.anchor.set(1, 0); // right, top LK.gui.topRight.addChild(scoreText); // Progress display (top center) progressText = new Text2("1 / 50", { size: 70, fill: 0x444444 }); progressText.anchor.set(0.5, 0); LK.gui.top.addChild(progressText); // Question text (centered, top 1/3 of screen) questionText = new Text2("", { size: 110, fill: 0x222222, wordWrap: true, wordWrapWidth: 1800 }); questionText.anchor.set(0.5, 0.5); questionText.x = 2048 / 2; questionText.y = 700; game.addChild(questionText); // Answer buttons (4, vertically stacked, centered) var buttonWidth = 1400; var buttonHeight = 220; var buttonSpacing = 80; var buttonStartY = 1100; var buttonColor = 0xeeeeee; var buttonColorCorrect = 0x8be78b; var buttonColorWrong = 0xf77b7b; var buttonTextColor = "#222222"; function createAnswerButton(i) { var btn = new Container(); var bg = btn.attachAsset('answerBtn' + i, { width: buttonWidth, height: buttonHeight, color: buttonColor, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); var txt = new Text2("", { size: 80, fill: buttonTextColor, wordWrap: true, wordWrapWidth: buttonWidth - 80 }); txt.anchor.set(0.5, 0.5); txt.x = 0; txt.y = 0; btn.addChild(txt); btn.x = 2048 / 2; btn.y = buttonStartY + i * (buttonHeight + buttonSpacing); btn.interactive = true; btn.buttonIndex = i; btn.bg = bg; btn.txt = txt; btn.down = function (x, y, obj) { if (!canAnswer) return; handleAnswer(btn.buttonIndex); }; game.addChild(btn); return btn; } for (var i = 0; i < 4; i++) { answerButtons.push(createAnswerButton(i)); } // --- Game Logic --- function startGame() { questions = pickRandomQuestions(questionPool, 10); currentQuestion = 0; score = 0; canAnswer = true; scoreText.setText("Score: 0"); showQuestion(); } function showQuestion() { canAnswer = true; var q = questions[currentQuestion]; questionText.setText(q.q); progressText.setText(currentQuestion + 1 + " / 10"); for (var i = 0; i < 4; i++) { answerButtons[i].txt.setText(q.choices[i]); answerButtons[i].bg.color = buttonColor; answerButtons[i].bg.tint = buttonColor; answerButtons[i].visible = true; } } function handleAnswer(selected) { canAnswer = false; var q = questions[currentQuestion]; var correct = q.answer; // Color feedback for (var i = 0; i < 4; i++) { if (i === correct) { tween(answerButtons[i].bg, { tint: buttonColorCorrect }, { duration: 200, easing: tween.easeIn }); } else if (i === selected) { tween(answerButtons[i].bg, { tint: buttonColorWrong }, { duration: 200, easing: tween.easeIn }); } else { tween(answerButtons[i].bg, { tint: buttonColor }, { duration: 200, easing: tween.easeIn }); } } // Update score if correct, otherwise trigger game over immediately if (selected === correct) { score++; scoreText.setText("Score: " + score); // --- Play correct answer sound --- LK.getSound('correct').play(); // --- Confetti burst effect from bottom --- var confetti = new ConfettiBurst(); game.addChild(confetti); // Wait, then next question or end LK.setTimeout(function () { currentQuestion++; if (currentQuestion < 10) { showQuestion(); } else { showEnd(); } }, 700); } else { // Wrong answer: show feedback, then game over // --- Play wrong answer sound --- LK.getSound('wrong').play(); LK.setTimeout(function () { showEnd(); }, 700); } } function showEnd() { // Hide answer buttons for (var i = 0; i < 4; i++) { answerButtons[i].visible = false; } questionText.setText("Quiz Over!\nYou scored " + score + " out of 10."); progressText.setText("Done!"); // Show game over popup (handled by LK) LK.setScore(score); LK.showGameOver(); } // --- Start the game --- startGame(); // Play chill background music LK.playMusic('chill_song');
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// --- Optional: Allow restart on game over (handled by LK) ---
// --- Touchscreen compatibility: all controls are via .down events on buttons ---
// --- No music, sound, or pause ---
// --- No elements in top left 100x100 px (all UI is top, topRight, or center) ---
// --- No background art, just clean white ---
// --- All elements are visible and centered for mobile ---
// --- No keyboard controls ---
// --- No dynamic resizing code needed ---
// --- MVP complete ---
// ConfettiBurst: A visual effect of confetti exploding from the bottom of the screen
var ConfettiBurst = Container.expand(function () {
var self = Container.call(this);
// Number of confetti pieces
var pieces = 32 + Math.floor(Math.random() * 12); // 32-43 pieces
var centerX = 2048 / 2;
var baseY = 2732 - 60; // 60px from bottom
var minLen = 600,
maxLen = 1200;
var minSize = 40,
maxSize = 80;
var colors = [0xff5e5e, 0x5ecbff, 0xffe15e, 0x7cff5e, 0xb95eff, 0xff5edb, 0x5effb9, 0xffffff];
for (var i = 0; i < pieces; i++) {
var angle = -Math.PI / 2 + (Math.random() - 0.5) * Math.PI * 0.9; // -80deg to +80deg
var len = minLen + Math.random() * (maxLen - minLen);
var size = minSize + Math.random() * (maxSize - minSize);
var color = colors[Math.floor(Math.random() * colors.length)];
var conf = self.attachAsset('confetti' + i, {
width: size * (0.7 + Math.random() * 0.6),
height: size * (0.7 + Math.random() * 0.6),
color: color,
shape: 'box',
anchorX: 0.5,
anchorY: 1
});
conf.x = centerX + (Math.random() - 0.5) * 200;
conf.y = baseY;
conf.rotation = angle + (Math.random() - 0.5) * 0.5;
conf.alpha = 0.85 + Math.random() * 0.15;
// Animate: move out, rotate, fall, and fade
(function (confetti, angle, len) {
var targetX = confetti.x + Math.cos(angle) * len;
var targetY = confetti.y + Math.sin(angle) * len + 200 + Math.random() * 200;
var rot = confetti.rotation + (Math.random() - 0.5) * 2.5;
tween(confetti, {
x: targetX,
y: targetY,
rotation: rot,
alpha: 0
}, {
duration: 900 + Math.random() * 200,
easing: tween.easeOut,
onComplete: function onComplete() {
if (confetti.parent) confetti.parent.removeChild(confetti);
}
});
})(conf, angle, len);
}
// Remove the whole effect after animation
LK.setTimeout(function () {
if (self.parent) self.parent.removeChild(self);
}, 1200);
return self;
});
/****
* Initialize Game
****/
// No custom classes needed for MVP, as all elements are UI and static.
var game = new LK.Game({
backgroundColor: 0x87ceeb // Sky blue background for a friendly quiz look
});
/****
* Game Code
****/
// Background image asset (2048x2732, covers full game area)
// --- Add background image ---
var backgroundImg = LK.getAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
width: 2048,
height: 2732
});
game.addChild(backgroundImg);
// --- Question Pool ---
// Initialize chill background music asset
var questionPool = [
// Emoji
{
q: "What does the 🦄 emoji represent?",
choices: ["Unicorn", "Horse", "Rhino", "Dragon"],
answer: 0
}, {
q: "What does the 😂 emoji mean?",
choices: ["Crying", "Laughing with tears", "Angry", "Surprised"],
answer: 1
}, {
q: "What does the 🍕 emoji represent?",
choices: ["Cake", "Pizza", "Sandwich", "Pie"],
answer: 1
}, {
q: "What does the 🦁 emoji represent?",
choices: ["Tiger", "Lion", "Bear", "Dog"],
answer: 1
}, {
q: "What does the 🐧 emoji represent?",
choices: ["Penguin", "Duck", "Chicken", "Ostrich"],
answer: 0
}, {
q: "What does the 🥑 emoji represent?",
choices: ["Avocado", "Pear", "Apple", "Kiwi"],
answer: 0
}, {
q: "What does the 🦋 emoji represent?",
choices: ["Bee", "Butterfly", "Moth", "Dragonfly"],
answer: 1
}, {
q: "What does the 🏀 emoji represent?",
choices: ["Soccer", "Basketball", "Tennis", "Baseball"],
answer: 1
}, {
q: "What does the 🏰 emoji represent?",
choices: ["Palace", "Castle", "Hotel", "Temple"],
answer: 1
}, {
q: "What does the 🦒 emoji represent?",
choices: ["Camel", "Giraffe", "Horse", "Deer"],
answer: 1
},
// Flags
{
q: "Which country does this flag 🇯🇵 belong to?",
choices: ["China", "Japan", "South Korea", "Vietnam"],
answer: 1
}, {
q: "Which country does this flag 🇧🇷 belong to?",
choices: ["Argentina", "Brazil", "Mexico", "Colombia"],
answer: 1
}, {
q: "Which country does this flag 🇨🇦 belong to?",
choices: ["USA", "Canada", "UK", "Australia"],
answer: 1
}, {
q: "Which country does this flag 🇫🇷 belong to?",
choices: ["Italy", "France", "Netherlands", "Russia"],
answer: 1
}, {
q: "Which country does this flag 🇮🇳 belong to?",
choices: ["Pakistan", "India", "Bangladesh", "Nepal"],
answer: 1
}, {
q: "Which country does this flag 🇦🇺 belong to?",
choices: ["New Zealand", "Australia", "UK", "USA"],
answer: 1
}, {
q: "Which country does this flag 🇩🇪 belong to?",
choices: ["Belgium", "Germany", "Austria", "Switzerland"],
answer: 1
}, {
q: "Which country does this flag 🇪🇬 belong to?",
choices: ["Egypt", "Morocco", "Turkey", "Greece"],
answer: 0
}, {
q: "Which country does this flag 🇮🇹 belong to?",
choices: ["Ireland", "Italy", "Mexico", "Hungary"],
answer: 1
}, {
q: "Which country does this flag 🇪🇸 belong to?",
choices: ["Portugal", "Spain", "France", "Chile"],
answer: 1
},
// Animal Facts
{
q: "Which animal is the largest land animal?",
choices: ["Elephant", "Giraffe", "Rhino", "Hippo"],
answer: 0
}, {
q: "Which animal is known for changing its color?",
choices: ["Chameleon", "Frog", "Snake", "Lizard"],
answer: 0
}, {
q: "Which animal is the fastest on land?",
choices: ["Cheetah", "Lion", "Horse", "Kangaroo"],
answer: 0
}, {
q: "Which animal can fly backwards?",
choices: ["Hummingbird", "Eagle", "Bat", "Sparrow"],
answer: 0
}, {
q: "Which animal is known as the king of the jungle?",
choices: ["Lion", "Tiger", "Bear", "Wolf"],
answer: 0
}, {
q: "Which animal sleeps standing up?",
choices: ["Horse", "Dog", "Cat", "Rabbit"],
answer: 0
}, {
q: "Which animal has black and white stripes?",
choices: ["Zebra", "Tiger", "Panda", "Skunk"],
answer: 0
}, {
q: "Which animal is the tallest in the world?",
choices: ["Giraffe", "Elephant", "Camel", "Ostrich"],
answer: 0
}, {
q: "Which animal is famous for its memory?",
choices: ["Elephant", "Dog", "Cat", "Dolphin"],
answer: 0
}, {
q: "Which animal is a marsupial?",
choices: ["Kangaroo", "Horse", "Cow", "Sheep"],
answer: 0
}];
// --- Game State ---
var questions = []; // The 30 questions for this round
var currentQuestion = 0;
var score = 0;
var answerButtons = [];
var questionText = null;
var scoreText = null;
var progressText = null;
var canAnswer = true;
// --- Utility: Shuffle and pick N ---
function pickRandomQuestions(pool, n) {
var arr = [];
var used = [];
var len = pool.length;
for (var i = 0; i < n; i++) {
var idx;
do {
idx = Math.floor(Math.random() * len);
} while (used.indexOf(idx) !== -1);
used.push(idx);
arr.push(pool[idx]);
}
return arr;
}
// --- UI Setup ---
// Score display (top right, away from top left menu)
scoreText = new Text2("Score: 0", {
size: 80,
fill: 0x222222
});
scoreText.anchor.set(1, 0); // right, top
LK.gui.topRight.addChild(scoreText);
// Progress display (top center)
progressText = new Text2("1 / 50", {
size: 70,
fill: 0x444444
});
progressText.anchor.set(0.5, 0);
LK.gui.top.addChild(progressText);
// Question text (centered, top 1/3 of screen)
questionText = new Text2("", {
size: 110,
fill: 0x222222,
wordWrap: true,
wordWrapWidth: 1800
});
questionText.anchor.set(0.5, 0.5);
questionText.x = 2048 / 2;
questionText.y = 700;
game.addChild(questionText);
// Answer buttons (4, vertically stacked, centered)
var buttonWidth = 1400;
var buttonHeight = 220;
var buttonSpacing = 80;
var buttonStartY = 1100;
var buttonColor = 0xeeeeee;
var buttonColorCorrect = 0x8be78b;
var buttonColorWrong = 0xf77b7b;
var buttonTextColor = "#222222";
function createAnswerButton(i) {
var btn = new Container();
var bg = btn.attachAsset('answerBtn' + i, {
width: buttonWidth,
height: buttonHeight,
color: buttonColor,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5
});
var txt = new Text2("", {
size: 80,
fill: buttonTextColor,
wordWrap: true,
wordWrapWidth: buttonWidth - 80
});
txt.anchor.set(0.5, 0.5);
txt.x = 0;
txt.y = 0;
btn.addChild(txt);
btn.x = 2048 / 2;
btn.y = buttonStartY + i * (buttonHeight + buttonSpacing);
btn.interactive = true;
btn.buttonIndex = i;
btn.bg = bg;
btn.txt = txt;
btn.down = function (x, y, obj) {
if (!canAnswer) return;
handleAnswer(btn.buttonIndex);
};
game.addChild(btn);
return btn;
}
for (var i = 0; i < 4; i++) {
answerButtons.push(createAnswerButton(i));
}
// --- Game Logic ---
function startGame() {
questions = pickRandomQuestions(questionPool, 10);
currentQuestion = 0;
score = 0;
canAnswer = true;
scoreText.setText("Score: 0");
showQuestion();
}
function showQuestion() {
canAnswer = true;
var q = questions[currentQuestion];
questionText.setText(q.q);
progressText.setText(currentQuestion + 1 + " / 10");
for (var i = 0; i < 4; i++) {
answerButtons[i].txt.setText(q.choices[i]);
answerButtons[i].bg.color = buttonColor;
answerButtons[i].bg.tint = buttonColor;
answerButtons[i].visible = true;
}
}
function handleAnswer(selected) {
canAnswer = false;
var q = questions[currentQuestion];
var correct = q.answer;
// Color feedback
for (var i = 0; i < 4; i++) {
if (i === correct) {
tween(answerButtons[i].bg, {
tint: buttonColorCorrect
}, {
duration: 200,
easing: tween.easeIn
});
} else if (i === selected) {
tween(answerButtons[i].bg, {
tint: buttonColorWrong
}, {
duration: 200,
easing: tween.easeIn
});
} else {
tween(answerButtons[i].bg, {
tint: buttonColor
}, {
duration: 200,
easing: tween.easeIn
});
}
}
// Update score if correct, otherwise trigger game over immediately
if (selected === correct) {
score++;
scoreText.setText("Score: " + score);
// --- Play correct answer sound ---
LK.getSound('correct').play();
// --- Confetti burst effect from bottom ---
var confetti = new ConfettiBurst();
game.addChild(confetti);
// Wait, then next question or end
LK.setTimeout(function () {
currentQuestion++;
if (currentQuestion < 10) {
showQuestion();
} else {
showEnd();
}
}, 700);
} else {
// Wrong answer: show feedback, then game over
// --- Play wrong answer sound ---
LK.getSound('wrong').play();
LK.setTimeout(function () {
showEnd();
}, 700);
}
}
function showEnd() {
// Hide answer buttons
for (var i = 0; i < 4; i++) {
answerButtons[i].visible = false;
}
questionText.setText("Quiz Over!\nYou scored " + score + " out of 10.");
progressText.setText("Done!");
// Show game over popup (handled by LK)
LK.setScore(score);
LK.showGameOver();
}
// --- Start the game ---
startGame();
// Play chill background music
LK.playMusic('chill_song');