User prompt
So under the icon say the name of the category
User prompt
So next to the question there will be an icon that represents what the question is about: nature, science, geography, and the rest.
User prompt
Proceed to do what you consider a good and great update to the game ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
So you have three lives displayed in the top corner and every time you fail you lose one and when you lose them all you lose
Code edit (1 edits merged)
Please save this source code
User prompt
Quiz Quest: True or False
Initial prompt
Create a game where you have to choose two options, only one is good, the other makes you lose. Questions like: What does photosynthesis do? And there are two answers: pig or tree.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var AnswerButton = Container.expand(function () { var self = Container.call(this); self.isCorrect = false; self.answered = false; self.answerIndex = 0; // Button background self.buttonBg = self.attachAsset('answerButton', { anchorX: 0.5, anchorY: 0.5 }); // Answer text self.answerText = new Text2('', { size: 60, fill: 0xFFFFFF, wordWrap: true, wordWrapWidth: 750 }); self.answerText.anchor.set(0.5, 0.5); self.addChild(self.answerText); self.setAnswer = function (text, correct, index) { self.answerText.setText(text); self.isCorrect = correct; self.answerIndex = index || 0; }; self.showCorrect = function () { self.removeChild(self.buttonBg); self.buttonBg = self.attachAsset('correctButton', { anchorX: 0.5, anchorY: 0.5 }); self.addChildAt(self.buttonBg, 0); }; self.showWrong = function () { self.removeChild(self.buttonBg); self.buttonBg = self.attachAsset('wrongButton', { anchorX: 0.5, anchorY: 0.5 }); self.addChildAt(self.buttonBg, 0); }; self.move = function (x, y, obj) { if (self.answered) return; // Add subtle hover effect if (!self.isHovering) { self.isHovering = true; LK.getSound('hover').play(); tween(self, { scaleX: 1.05, scaleY: 1.05 }, { duration: 150, easing: tween.easeOut }); } }; self.up = function (x, y, obj) { // Remove hover effect when touch/mouse is released if (self.isHovering) { self.isHovering = false; if (!self.answered) { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 150, easing: tween.easeOut }); } } }; self.down = function (x, y, obj) { if (self.answered || answered) return; self.answered = true; answered = true; LK.getSound('click').play(); // Mark all buttons as answered to prevent multiple presses var allButtons = [answerButton1, answerButton2, answerButton3, answerButton4]; for (var ab = 0; ab < allButtons.length; ab++) { if (allButtons[ab]) { allButtons[ab].answered = true; } } // Add press animation tween(self, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.bounceOut }); } }); if (self.isCorrect) { // Correct answer self.showCorrect(); LK.effects.flashObject(self, 0x27ae60, 500); LK.getSound('correct').play(); // Calculate points based on difficulty var currentQuestion = mixedQuestions[currentQuestionIndex - 1]; var points = 1; // Default points for easy questions if (currentQuestion.answers.length === 4) { points = 4; // Super difficulty (4 answers) gives 4 points } else if (currentQuestion.special) { points = 2; // Hard difficulty (special questions) gives 2 points } LK.setScore(LK.getScore() + points); scoreTxt.setText(LK.getScore()); // Check if this is a super health question for healing if (currentQuestion.category === "health" && currentQuestion.answers.length === 4) { // Super health questions heal the player if (lives < 3) { lives++; livesTxt.setText('Lives: ' + lives); // Add healing animation with green heart effect tween(livesTxt, { scaleX: 1.4, scaleY: 1.4, tint: 0x27ae60 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(livesTxt, { scaleX: 1, scaleY: 1, tint: 0xffffff }, { duration: 400, easing: tween.bounceOut }); } }); // Create healing particle effects for (var h = 0; h < 12; h++) { var healParticle = game.addChild(new Particle()); var globalPos = self.parent.toGlobal(self.position); healParticle.animate(globalPos.x, globalPos.y); healParticle.particle.tint = 0x27ae60; // Green healing color } } } // Create particle celebration effect for (var p = 0; p < 8; p++) { var particle = game.addChild(new Particle()); var globalPos = self.parent.toGlobal(self.position); particle.animate(globalPos.x, globalPos.y); } // Add score celebration animation with green color and jump effect tween(scoreTxt, { scaleX: 1.3, scaleY: 1.3, tint: 0x27ae60, y: scoreTxt.y - 30 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(scoreTxt, { scaleX: 1, scaleY: 1, tint: 0xFFFFFF, y: scoreTxt.y + 30 }, { duration: 300, easing: tween.bounceOut }); } }); // Show next question after delay LK.setTimeout(function () { showNextQuestion(); }, 1000); } else { // Wrong answer self.showWrong(); LK.effects.flashObject(self, 0xe74c3c, 500); LK.effects.flashScreen(0xe74c3c, 1000); LK.getSound('wrong').play(); // Show correct answer for all buttons var allButtons = [answerButton1, answerButton2, answerButton3, answerButton4]; for (var b = 0; b < allButtons.length; b++) { if (allButtons[b] && allButtons[b].isCorrect) { allButtons[b].showCorrect(); } } // Lose a life lives--; livesTxt.setText('Lives: ' + lives); // Add life loss animation with breathing effect tween(livesTxt, { scaleX: 1.4, scaleY: 1.4, tint: 0xff0000 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { // Create breathing effect for low lives function breatheEffect() { if (lives <= 1) { tween(livesTxt, { scaleX: 1.1, scaleY: 1.1 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { tween(livesTxt, { scaleX: 1, scaleY: 1 }, { duration: 800, easing: tween.easeInOut, onFinish: breatheEffect }); } }); } } tween(livesTxt, { scaleX: 1, scaleY: 1, tint: 0xffffff }, { duration: 400, easing: tween.easeOut, onFinish: breatheEffect }); } }); // Check if game over or continue LK.setTimeout(function () { if (lives <= 0) { LK.showGameOver(); } else { showNextQuestion(); } }, 2000); } }; return self; }); var Particle = Container.expand(function () { var self = Container.call(this); self.particle = self.attachAsset('themeIcon1', { anchorX: 0.5, anchorY: 0.5 }); self.particle.width = 20; self.particle.height = 20; self.particle.tint = 0xFFD700; self.animate = function (targetX, targetY) { // Random velocity and angle var angle = Math.random() * Math.PI * 2; var speed = 150 + Math.random() * 300; var vx = Math.cos(angle) * speed; var vy = Math.sin(angle) * speed; self.x = targetX; self.y = targetY; // Add random colors for more vibrant effects var colors = [0xFFD700, 0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0x96CEB4, 0xFECA57, 0xFF9FF3, 0x54A0FF]; self.particle.tint = colors[Math.floor(Math.random() * colors.length)]; // Add rotation animation var rotationSpeed = (Math.random() - 0.5) * 10; // Animate particle with enhanced physics-like motion tween(self, { x: self.x + vx, y: self.y + vy, alpha: 0, scaleX: 0.1, scaleY: 0.1, rotation: rotationSpeed }, { duration: 1200 + Math.random() * 800, easing: tween.easeOut, onFinish: function onFinish() { self.destroy(); } }); // Add a secondary tween for size pulsing during flight tween(self.particle, { scaleX: 1.5, scaleY: 1.5 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(self.particle, { scaleX: 1, scaleY: 1 }, { duration: 400, easing: tween.easeOut }); } }); }; return self; }); var Question = Container.expand(function () { var self = Container.call(this); // Question background var questionBg = self.attachAsset('questionBox', { anchorX: 0.5, anchorY: 0.5 }); // Category icon self.categoryIcon = null; // Category text self.categoryText = null; // Question text self.questionText = new Text2('', { size: 80, fill: 0xFFFFFF, wordWrap: true, wordWrapWidth: 1500 }); self.questionText.anchor.set(0.5, 0.5); self.questionText.x = 100; // Offset to make room for icon self.addChild(self.questionText); self.setQuestion = function (text, category, isSpecial, answerCount) { self.questionText.setText(text); // Determine difficulty level based on question length, special status, and answer count var difficulty = 'Easy'; var difficultyColor = 0x27ae60; // Green for easy if (answerCount === 4) { difficulty = 'Super'; difficultyColor = 0xe74c3c; // Red for super difficulty (4 answers) } else if (isSpecial) { difficulty = 'Hard'; difficultyColor = 0xe74c3c; // Red for hard } else if (text.length > 100) { difficulty = 'Medium'; difficultyColor = 0xf39c12; // Orange for medium } // Remove existing category icon if any if (self.categoryIcon) { self.removeChild(self.categoryIcon); } // Add new category icon var iconAsset = category + 'Icon'; self.categoryIcon = self.attachAsset(iconAsset, { anchorX: 0.5, anchorY: 0.5 }); self.categoryIcon.x = -700; // Position to the left of text self.categoryIcon.y = -50; // Add pulsing animation to category icon function pulseIcon() { tween(self.categoryIcon, { scaleX: 1.2, scaleY: 1.2 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { tween(self.categoryIcon, { scaleX: 1, scaleY: 1 }, { duration: 1000, easing: tween.easeInOut, onFinish: pulseIcon }); } }); } pulseIcon(); // Add special question indicator if (isSpecial && (difficulty === 'Hard' || difficulty === 'Super')) { // Gold tint for special questions // Add rainbow cycling animation for difficult and super questions only var cycleSpecialColors = function cycleSpecialColors() { var colors = [0xFFD700, 0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0x96CEB4, 0xFECA57]; var currentColorIndex = 0; function nextColor() { currentColorIndex = (currentColorIndex + 1) % colors.length; tween(self.categoryIcon, { tint: colors[currentColorIndex] }, { duration: 800, easing: tween.easeInOut, onFinish: nextColor }); } nextColor(); }; self.categoryIcon.tint = 0xFFD700; cycleSpecialColors(); } else if (isSpecial) { // For easy special questions, just use gold tint without rainbow animation self.categoryIcon.tint = 0xFFD700; } // Add category name text if (self.categoryText) { self.removeChild(self.categoryText); } var categoryDisplayText = category.charAt(0).toUpperCase() + category.slice(1); if (isSpecial) { categoryDisplayText += " ★"; } categoryDisplayText += " (" + difficulty + ")"; self.categoryText = new Text2(categoryDisplayText, { size: 40, fill: isSpecial ? 0xFFD700 : difficultyColor }); self.categoryText.anchor.set(0.5, 0.5); self.categoryText.x = -700; // Same x as icon self.categoryText.y = 50; // Below the icon self.addChild(self.categoryText); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xFFB366 }); /**** * Game Code ****/ var questions = [{ question: "The Sun is a star.", answers: ["True", "False"], correct: 0, category: "science" }, { question: "Penguins can fly.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "What is the largest plant in the world?", answers: ["A Redwood Tree", "The General Sherman Tree"], correct: 1, category: "nature", special: true }, { question: "Water boils at 100°C at sea level.", answers: ["True", "False"], correct: 0, category: "science" }, { question: "The Great Wall of China is visible from space.", answers: ["True", "False"], correct: 1, category: "geography" }, { question: "Which planet is closest to the Sun?", answers: ["Venus", "Mercury"], correct: 1, category: "science", special: true }, { question: "Sharks are mammals.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "Lightning never strikes the same place twice.", answers: ["True", "False"], correct: 1, category: "science" }, { question: "What is the smallest country in the world?", answers: ["Monaco", "Vatican City"], correct: 1, category: "geography", special: true }, { question: "Goldfish have a 3-second memory.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "Bananas are berries.", answers: ["True", "False"], correct: 0, category: "nature" }, { question: "What is the deepest ocean trench?", answers: ["Puerto Rico Trench", "Mariana Trench"], correct: 1, category: "geography", special: true }, { question: "The human body has 206 bones.", answers: ["True", "False"], correct: 0, category: "science" }, { question: "Mount Everest is the tallest mountain on Earth.", answers: ["True", "False"], correct: 0, category: "geography" }, { question: "Which mammal is known to have the most powerful bite?", answers: ["Lion", "Hippopotamus"], correct: 1, category: "nature", special: true }, { question: "Octopuses have three hearts.", answers: ["True", "False"], correct: 0, category: "nature" }, { question: "The Earth is flat.", answers: ["True", "False"], correct: 1, category: "geography" }, { question: "What is the hardest natural substance on Earth?", answers: ["Titanium", "Diamond"], correct: 1, category: "science", special: true }, { question: "Honey never spoils.", answers: ["True", "False"], correct: 0, category: "general" }, { question: "Humans only use 10% of their brain.", answers: ["True", "False"], correct: 1, category: "science" }, { question: "The Moon has its own light.", answers: ["True", "False"], correct: 1, category: "science" }, { question: "Spiders are insects.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "The Sahara is the largest desert in the world.", answers: ["True", "False"], correct: 1, category: "geography" }, { question: "All birds can fly.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "The Statue of Liberty was a gift from France.", answers: ["True", "False"], correct: 0, category: "history" }, { question: "Fish can drown in water.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "Antarctica is the coldest continent.", answers: ["True", "False"], correct: 0, category: "geography" }, { question: "Dolphins are fish.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "The Amazon River is longer than the Nile River.", answers: ["True", "False"], correct: 0, category: "geography" }, { question: "Glass is a liquid.", answers: ["True", "False"], correct: 1, category: "science" }, { question: "Crocodiles are older than dinosaurs.", answers: ["True", "False"], correct: 0, category: "history" }, { question: "The human heart has four chambers.", answers: ["True", "False"], correct: 0, category: "science" }, { question: "Which was invented first?", answers: ["The wheel", "Sliced bread"], correct: 0, category: "history", special: true }, { question: "What causes thunder?", answers: ["Lightning heating air", "Clouds colliding"], correct: 0, category: "science", special: true }, { question: "Which animal sleeps the most per day?", answers: ["Sloth", "Koala"], correct: 1, category: "nature", special: true }, { question: "What is the most spoken language in the world?", answers: ["English", "Mandarin Chinese"], correct: 1, category: "general", special: true }, { question: "Which ocean is the largest?", answers: ["Atlantic Ocean", "Pacific Ocean"], correct: 1, category: "geography", special: true }, { question: "What is the fastest land animal?", answers: ["Cheetah", "Pronghorn Antelope"], correct: 0, category: "nature", special: true }, { question: "A group of lions is called a pride.", answers: ["True", "False"], correct: 0, category: "nature" }, { question: "The human brain uses about 20% of the body's total energy.", answers: ["True", "False"], correct: 0, category: "science" }, { question: "Australia is both a country and a continent.", answers: ["True", "False"], correct: 0, category: "geography" }, { question: "Bats are blind.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "The Eiffel Tower can be 15 cm taller during summer.", answers: ["True", "False"], correct: 0, category: "science" }, { question: "Russia spans 11 time zones.", answers: ["True", "False"], correct: 0, category: "geography" }, { question: "Butterflies taste with their feet.", answers: ["True", "False"], correct: 0, category: "nature" }, { question: "Sound travels faster in water than in air.", answers: ["True", "False"], correct: 0, category: "science" }, { question: "The Pacific Ring of Fire is a major area of earthquake activity.", answers: ["True", "False"], correct: 0, category: "geography" }, { question: "Elephants are afraid of mice.", answers: ["True", "False"], correct: 1, category: "nature" }, { question: "Which gas makes up most of Earth's atmosphere?", answers: ["Oxygen", "Nitrogen"], correct: 1, category: "science", special: true }, { question: "What is the most abundant metal in Earth's crust?", answers: ["Iron", "Aluminum"], correct: 1, category: "science", special: true }, { question: "Which bird can fly backwards?", answers: ["Hummingbird", "Swift"], correct: 0, category: "nature", special: true }, { question: "What is the longest river in Europe?", answers: ["Danube", "Volga"], correct: 1, category: "geography", special: true }, { question: "Which planet has the most moons?", answers: ["Jupiter", "Saturn"], correct: 1, category: "science", special: true }, { question: "What percentage of the human body is water?", answers: ["About 60%", "About 80%"], correct: 0, category: "science", special: true }, { question: "Which country has the most natural lakes?", answers: ["Canada", "Finland"], correct: 0, category: "geography", special: true }, { question: "What is the only mammal capable of true flight?", answers: ["Flying squirrel", "Bat"], correct: 1, category: "nature", special: true }, { question: "Which chemical element has the atomic number 1?", answers: ["Helium", "Hydrogen", "Lithium", "Carbon"], correct: 1, category: "science", special: true, difficulty: "extra" }, { question: "What is the capital of Kazakhstan?", answers: ["Almaty", "Nur-Sultan", "Shymkent", "Astana"], correct: 1, category: "geography", special: true, difficulty: "extra" }, { question: "Which author wrote 'One Hundred Years of Solitude'?", answers: ["Mario Vargas Llosa", "Gabriel García Márquez", "Jorge Luis Borges", "Octavio Paz"], correct: 1, category: "general", special: true, difficulty: "extra" }, { question: "What is the smallest unit of matter that retains the properties of an element?", answers: ["Molecule", "Atom", "Electron", "Proton"], correct: 1, category: "science", special: true, difficulty: "extra" }, { question: "Which dynasty ruled China for the longest period?", answers: ["Ming Dynasty", "Qing Dynasty", "Zhou Dynasty", "Han Dynasty"], correct: 2, category: "history", special: true, difficulty: "extra" }, { question: "What is the process by which plants make their own food?", answers: ["Respiration", "Photosynthesis", "Transpiration", "Fertilization"], correct: 1, category: "nature", special: true, difficulty: "extra" }, { question: "Which programming language was developed by Guido van Rossum?", answers: ["Java", "Python", "C++", "JavaScript"], correct: 1, category: "science", special: true, difficulty: "extra" }, { question: "What is the largest organ in the human body?", answers: ["Liver", "Brain", "Skin", "Lungs"], correct: 2, category: "science", special: true, difficulty: "extra" }, { question: "Tomatoes are vegetables.", answers: ["True", "False"], correct: 1, category: "gastronomy" }, { question: "What spice is derived from the Crocus flower?", answers: ["Paprika", "Saffron"], correct: 1, category: "gastronomy", special: true }, { question: "Chocolate comes from cocoa beans.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "Which country is famous for inventing pasta?", answers: ["China", "Italy"], correct: 1, category: "gastronomy", special: true }, { question: "Honey is made by bees from flower nectar.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "What is the main ingredient in guacamole?", answers: ["Lime", "Avocado"], correct: 1, category: "gastronomy", special: true }, { question: "Coffee beans are actually seeds.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "Which herb is commonly used in Italian cuisine?", answers: ["Basil", "Cilantro"], correct: 0, category: "gastronomy", special: true }, { question: "Vanilla is the most expensive spice in the world.", answers: ["True", "False"], correct: 1, category: "gastronomy" }, { question: "What type of pastry is used to make profiteroles?", answers: ["Puff pastry", "Choux pastry"], correct: 1, category: "gastronomy", special: true }, { question: "Mushrooms are vegetables.", answers: ["True", "False"], correct: 1, category: "gastronomy" }, { question: "Which cooking method uses dry heat in an oven?", answers: ["Braising", "Roasting"], correct: 1, category: "gastronomy", special: true }, { question: "Salt enhances the flavor of food.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "What is the main ingredient in traditional hummus?", answers: ["Lentils", "Chickpeas"], correct: 1, category: "gastronomy", special: true }, { question: "Bread rises because of yeast.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "Which cooking technique involves cooking food in its own fat?", answers: ["Confit", "Sauté"], correct: 0, category: "gastronomy", special: true }, { question: "Olive oil comes from olives.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "What is the French term for 'cooking everything together'?", answers: ["Mise en place", "Casserole"], correct: 1, category: "gastronomy", special: true }, { question: "Cheese is made from milk.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "Which country is the origin of sushi?", answers: ["China", "Japan"], correct: 1, category: "gastronomy", special: true }, { question: "Fermentation is used to make wine.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "What is the main ingredient in traditional pesto?", answers: ["Parsley", "Basil"], correct: 1, category: "gastronomy", special: true }, { question: "Butter is made from cream.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "Which technique involves cooking food slowly in liquid?", answers: ["Grilling", "Braising"], correct: 1, category: "gastronomy", special: true }, { question: "Eggs are a source of protein.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "What is the most consumed beverage in the world after water?", answers: ["Coffee", "Tea"], correct: 1, category: "gastronomy", special: true }, { question: "Caramelization occurs when sugar is heated.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "Which knife cut produces small cubes?", answers: ["Julienne", "Brunoise"], correct: 1, category: "gastronomy", special: true }, { question: "Gelato contains less air than ice cream.", answers: ["True", "False"], correct: 0, category: "gastronomy" }, { question: "What is the main ingredient in traditional mayonnaise?", answers: ["Egg yolks", "Cream", "Butter", "Milk"], correct: 0, category: "gastronomy", special: true, difficulty: "extra" }, { question: "Which cooking method uses moist heat?", answers: ["Roasting", "Steaming", "Grilling", "Sautéing"], correct: 1, category: "gastronomy", special: true, difficulty: "extra" }, { question: "What is the French culinary term for 'everything in its place'?", answers: ["Mise en place", "Sous vide", "Confit", "Flambé"], correct: 0, category: "gastronomy", special: true, difficulty: "extra" }, { question: "Which mother sauce is made with a blonde roux and stock?", answers: ["Béchamel", "Velouté", "Espagnole", "Hollandaise"], correct: 1, category: "gastronomy", special: true, difficulty: "extra" }, { question: "The human heart has four chambers.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "Exercise helps strengthen the cardiovascular system.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "What is the recommended daily water intake for adults?", answers: ["4 glasses", "8 glasses"], correct: 1, category: "health", special: true }, { question: "Smoking damages the lungs.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "Which vitamin is produced by the skin when exposed to sunlight?", answers: ["Vitamin C", "Vitamin D"], correct: 1, category: "health", special: true }, { question: "Sleep is important for mental health.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "What is the normal resting heart rate for adults?", answers: ["60-100 beats per minute", "100-140 beats per minute"], correct: 0, category: "health", special: true }, { question: "Calcium is important for bone health.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "Which organ filters toxins from the blood?", answers: ["Kidney", "Liver"], correct: 1, category: "health", special: true }, { question: "Stress can affect physical health.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "What is the main function of red blood cells?", answers: ["Fight infection", "Carry oxygen"], correct: 1, category: "health", special: true }, { question: "Regular handwashing prevents disease.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "Which nutrient provides the most energy per gram?", answers: ["Carbohydrates", "Fats"], correct: 1, category: "health", special: true }, { question: "Fruits and vegetables are good sources of vitamins.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "What is the medical term for high blood pressure?", answers: ["Hypotension", "Hypertension"], correct: 1, category: "health", special: true }, { question: "Meditation can reduce stress levels.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "Which type of exercise strengthens the heart muscle?", answers: ["Stretching", "Aerobic exercise"], correct: 1, category: "health", special: true }, { question: "The immune system protects against disease.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "What is the body's largest organ?", answers: ["Liver", "Skin"], correct: 1, category: "health", special: true }, { question: "Fiber aids in digestion.", answers: ["True", "False"], correct: 0, category: "health" }, { question: "Which mineral is essential for healthy teeth and bones?", answers: ["Iron", "Calcium", "Zinc", "Magnesium"], correct: 1, category: "health", special: true, difficulty: "extra" }, { question: "What is the recommended amount of sleep for adults?", answers: ["5-6 hours", "7-9 hours", "10-12 hours", "4-5 hours"], correct: 1, category: "health", special: true, difficulty: "extra" }, { question: "Which part of the brain controls balance and coordination?", answers: ["Cerebrum", "Cerebellum", "Brain stem", "Hippocampus"], correct: 1, category: "health", special: true, difficulty: "extra" }, { question: "What is the medical term for difficulty sleeping?", answers: ["Insomnia", "Narcolepsy", "Sleep apnea", "Hypersomnia"], correct: 0, category: "health", special: true, difficulty: "extra" }, { question: "A lever is a simple machine.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "Friction always opposes motion.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "Which simple machine helps lift heavy objects with less force?", answers: ["Wheel", "Pulley"], correct: 1, category: "mechanics", special: true }, { question: "Gears can change the direction of force.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "What type of energy is stored in a compressed spring?", answers: ["Kinetic energy", "Potential energy"], correct: 1, category: "mechanics", special: true }, { question: "Inertia is the tendency of objects to resist changes in motion.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "Which force pulls objects toward Earth's center?", answers: ["Magnetism", "Gravity"], correct: 1, category: "mechanics", special: true }, { question: "A screw is basically an inclined plane wrapped around a cylinder.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "What happens to the mechanical advantage when you increase the length of a lever arm?", answers: ["Decreases", "Increases"], correct: 1, category: "mechanics", special: true }, { question: "Hydraulic systems use liquid pressure to transmit force.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "Which law states that for every action there is an equal and opposite reaction?", answers: ["Newton's Second Law", "Newton's Third Law"], correct: 1, category: "mechanics", special: true }, { question: "Ball bearings reduce friction in rotating machinery.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "What is the mechanical advantage of a fixed pulley?", answers: ["Greater than 1", "Equal to 1"], correct: 1, category: "mechanics", special: true }, { question: "Torque is a measure of rotational force.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "Which type of gear system increases speed but decreases torque?", answers: ["Large gear driving small gear", "Small gear driving large gear"], correct: 0, category: "mechanics", special: true }, { question: "Momentum is conserved in collisions.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "What is the unit of measurement for force?", answers: ["Watt", "Newton"], correct: 1, category: "mechanics", special: true }, { question: "Centripetal force acts toward the center of circular motion.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "Which principle explains how airplanes generate lift?", answers: ["Archimedes' Principle", "Bernoulli's Principle"], correct: 1, category: "mechanics", special: true }, { question: "Elastic materials return to their original shape after deformation.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "What determines the period of a pendulum's swing?", answers: ["Mass of the bob", "Length of the string"], correct: 1, category: "mechanics", special: true }, { question: "Kinetic energy increases with the square of velocity.", answers: ["True", "False"], correct: 0, category: "mechanics" }, { question: "Which type of mechanical joint allows rotation in multiple directions?", answers: ["Hinge joint", "Ball joint", "Pin joint", "Universal joint"], correct: 3, category: "mechanics", special: true, difficulty: "extra" }, { question: "What is the efficiency formula for a machine?", answers: ["Input/Output × 100%", "Output/Input × 100%", "Work/Energy × 100%", "Force/Distance × 100%"], correct: 1, category: "mechanics", special: true, difficulty: "extra" }, { question: "Which type of stress occurs when forces try to stretch a material?", answers: ["Compression", "Tension", "Shear", "Torsion"], correct: 1, category: "mechanics", special: true, difficulty: "extra" }, { question: "What is the relationship between pressure, force, and area?", answers: ["P = F × A", "P = F / A", "P = A / F", "P = F + A"], correct: 1, category: "mechanics", special: true, difficulty: "extra" }, { question: "Movies are also called films.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Charlie Chaplin was a famous silent film actor.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which film won the first Academy Award for Best Picture?", answers: ["Sunrise", "Wings"], correct: 1, category: "cinema", special: true }, { question: "Alfred Hitchcock was known as the 'Master of Suspense'.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which director created the movie 'Jaws'?", answers: ["George Lucas", "Steven Spielberg"], correct: 1, category: "cinema", special: true }, { question: "The first color movie was made in the 1930s.", answers: ["True", "False"], correct: 1, category: "cinema" }, { question: "Which movie features the famous line 'May the Force be with you'?", answers: ["Star Trek", "Star Wars"], correct: 1, category: "cinema", special: true }, { question: "Animation movies are made using computer graphics only.", answers: ["True", "False"], correct: 1, category: "cinema" }, { question: "Which film studio created Mickey Mouse?", answers: ["Warner Bros", "Disney"], correct: 1, category: "cinema", special: true }, { question: "The movie 'Titanic' was based on a true story.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which actor played the character of Jack Sparrow?", answers: ["Orlando Bloom", "Johnny Depp"], correct: 1, category: "cinema", special: true }, { question: "Movie theaters show films on large screens.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which movie series features wizards and magic?", answers: ["Lord of the Rings", "Harry Potter"], correct: 1, category: "cinema", special: true }, { question: "Directors are responsible for making movies.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which movie won the Academy Award for Best Picture in 1994?", answers: ["The Lion King", "Forrest Gump"], correct: 1, category: "cinema", special: true }, { question: "Special effects make impossible things look real in movies.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which director is known for the movie 'E.T.'?", answers: ["James Cameron", "Steven Spielberg"], correct: 1, category: "cinema", special: true }, { question: "Movie scripts tell actors what to say and do.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which movie features a young lion named Simba?", answers: ["Jungle Book", "The Lion King"], correct: 1, category: "cinema", special: true }, { question: "Soundtracks enhance the emotional impact of movies.", answers: ["True", "False"], correct: 0, category: "cinema" }, { question: "Which film director created the movie 'Psycho'?", answers: ["Alfred Hitchcock", "Stanley Kubrick", "Martin Scorsese", "Francis Ford Coppola"], correct: 0, category: "cinema", special: true, difficulty: "extra" }, { question: "What does the term 'cinematography' refer to?", answers: ["Sound recording", "Camera work and visual composition", "Script writing", "Acting techniques"], correct: 1, category: "cinema", special: true, difficulty: "extra" }, { question: "Which movie won the Academy Award for Best Picture in 1972?", answers: ["The Godfather", "Cabaret", "Deliverance", "Sounder"], correct: 0, category: "cinema", special: true, difficulty: "extra" }, { question: "What is the standard frame rate for most movies?", answers: ["24 fps", "30 fps", "60 fps", "120 fps"], correct: 0, category: "cinema", special: true, difficulty: "extra" }]; var currentQuestionIndex = 0; var answered = false; var lives = 3; var questionsAnswered = 0; var nextSpecialQuestionAt = 3; // First special question after 3 questions // Score display var scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Lives display var livesTxt = new Text2('Lives: 3', { size: 80, fill: 0xFFFFFF }); livesTxt.anchor.set(1, 0); LK.gui.topRight.addChild(livesTxt); // Progress indicator var progressTxt = new Text2('Question 1', { size: 60, fill: 0xFFFFFF }); progressTxt.anchor.set(0, 0); progressTxt.x = 120; // Avoid top-left menu area progressTxt.y = 20; LK.gui.topLeft.addChild(progressTxt); // Question display var questionDisplay = game.addChild(new Question()); questionDisplay.x = 2048 / 2; questionDisplay.y = 800; // Answer buttons var answerButton1 = game.addChild(new AnswerButton()); answerButton1.x = 2048 / 2 - 450; answerButton1.y = 1500; var answerButton2 = game.addChild(new AnswerButton()); answerButton2.x = 2048 / 2 + 450; answerButton2.y = 1500; var answerButton3 = game.addChild(new AnswerButton()); answerButton3.x = 2048 / 2 - 450; answerButton3.y = 1750; var answerButton4 = game.addChild(new AnswerButton()); answerButton4.x = 2048 / 2 + 450; answerButton4.y = 1750; function showNextQuestion() { // Check if we need to generate more questions if (mixedQuestions.length <= currentQuestionIndex) { // Check if we have questions left to add if (regularIndex >= regularQuestions.length && specialIndex >= specialQuestions.length) { // Player completed all questions - they win! LK.showYouWin(); return; } // Determine if next question should be special var shouldShowSpecial = questionsAnswered >= nextSpecialQuestionAt && specialIndex < specialQuestions.length; if (shouldShowSpecial) { // Add special question mixedQuestions.push(specialQuestions[specialIndex]); specialIndex++; // Schedule next special question randomly (every 2-4 questions) nextSpecialQuestionAt = questionsAnswered + 2 + Math.floor(Math.random() * 3); } else if (regularIndex < regularQuestions.length) { // Add regular question mixedQuestions.push(regularQuestions[regularIndex]); regularIndex++; } else { // Only special questions left mixedQuestions.push(specialQuestions[specialIndex]); specialIndex++; } } var question = mixedQuestions[currentQuestionIndex]; // Reset button states answered = false; var allButtons = [answerButton1, answerButton2, answerButton3, answerButton4]; for (var b = 0; b < allButtons.length; b++) { if (allButtons[b]) { allButtons[b].answered = false; allButtons[b].removeChild(allButtons[b].buttonBg); allButtons[b].buttonBg = allButtons[b].attachAsset('answerButton', { anchorX: 0.5, anchorY: 0.5 }); allButtons[b].addChildAt(allButtons[b].buttonBg, 0); } } // Update progress indicator var totalQuestions = Math.min(questions.length, 20); // Limit display to reasonable number progressTxt.setText('Question ' + Math.min(questionsAnswered, totalQuestions)); // Set question and answers questionDisplay.setQuestion(question.question, question.category, question.special, question.answers.length); var is4Answer = question.answers.length === 4; // Set answers for all buttons answerButton1.setAnswer(question.answers[0], question.correct === 0, 0); answerButton2.setAnswer(question.answers[1], question.correct === 1, 1); // Handle 4-answer questions if (is4Answer) { answerButton3.setAnswer(question.answers[2], question.correct === 2, 2); answerButton4.setAnswer(question.answers[3], question.correct === 3, 3); answerButton3.visible = true; answerButton4.visible = true; // Adjust positions for 4-answer layout answerButton1.y = 1500; answerButton2.y = 1500; answerButton3.y = 1750; answerButton4.y = 1750; } else { // Hide buttons 3 and 4 for 2-answer questions answerButton3.visible = false; answerButton4.visible = false; // Adjust positions for 2-answer layout answerButton1.y = 1600; answerButton2.y = 1600; } // Reset hover states answerButton1.isHovering = false; answerButton2.isHovering = false; answerButton3.isHovering = false; answerButton4.isHovering = false; // Animate elements entrance questionDisplay.alpha = 0; questionDisplay.scaleX = 0.5; questionDisplay.scaleY = 0.5; tween(questionDisplay, { alpha: 1, scaleX: 1, scaleY: 1 }, { duration: 600, easing: tween.easeOut }); // Animate all visible buttons with staggered entrance var buttonsToAnimate = [answerButton1, answerButton2]; if (is4Answer) { buttonsToAnimate.push(answerButton3, answerButton4); } for (var b = 0; b < buttonsToAnimate.length; b++) { var button = buttonsToAnimate[b]; if (button && button.visible) { button.alpha = 0; button.scaleX = 0.3; button.scaleY = 0.3; var targetY = button.y; button.y = targetY + 300; button.rotation = Math.PI * 0.5; // Start rotated tween(button, { alpha: 1, y: targetY, scaleX: 1, scaleY: 1, rotation: 0 }, { duration: 600 + b * 150, easing: tween.bounceOut }); } } currentQuestionIndex++; questionsAnswered++; } // Separate questions into regular and special arrays var regularQuestions = []; var specialQuestions = []; for (var i = 0; i < questions.length; i++) { if (questions[i].special) { specialQuestions.push(questions[i]); } else { regularQuestions.push(questions[i]); } } // Shuffle both arrays function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } shuffleArray(regularQuestions); shuffleArray(specialQuestions); // Create mixed question sequence var mixedQuestions = []; var regularIndex = 0; var specialIndex = 0; // Start the game with entrance animations scoreTxt.setText(LK.getScore()); // Initial setup - hide elements for entrance animation questionDisplay.alpha = 0; answerButton1.alpha = 0; answerButton2.alpha = 0; answerButton3.alpha = 0; answerButton4.alpha = 0; answerButton3.visible = false; answerButton4.visible = false; // Animate score text entrance scoreTxt.y = -100; tween(scoreTxt, { y: 0 }, { duration: 800, easing: tween.bounceOut }); // Animate lives text entrance livesTxt.y = -100; tween(livesTxt, { y: 0 }, { duration: 900, easing: tween.bounceOut }); // Play background music LK.playMusic('FALSEorTRUE'); // Add floating animation to question display function startQuestionFloating() { tween(questionDisplay, { y: questionDisplay.y - 20 }, { duration: 2000, easing: tween.easeInOut, onFinish: function onFinish() { tween(questionDisplay, { y: questionDisplay.y + 20 }, { duration: 2000, easing: tween.easeInOut, onFinish: startQuestionFloating }); } }); } // Create animated background elements var backgroundParticles = []; var backgroundShapes = []; // Create floating background particles var _loop = function _loop() { particle = game.addChild(LK.getAsset('themeIcon1', { anchorX: 0.5, anchorY: 0.5 })); particle.width = 30 + Math.random() * 50; particle.height = particle.width; particle.x = Math.random() * 2048; particle.y = Math.random() * 2732; particle.alpha = 0.1 + Math.random() * 0.2; particle.tint = 0x3498db; // Light blue tint backgroundParticles.push(particle); // Add floating animation function createFloatingAnimation(p) { var targetX = Math.random() * 2048; var targetY = Math.random() * 2732; var duration = 8000 + Math.random() * 4000; tween(p, { x: targetX, y: targetY, rotation: p.rotation + Math.PI * 2 }, { duration: duration, easing: tween.easeInOut, onFinish: function onFinish() { createFloatingAnimation(p); } }); } createFloatingAnimation(particle); }, particle; for (var p = 0; p < 15; p++) { _loop(); } // Create geometric background shapes var _loop2 = function _loop2() { shape = game.addChild(LK.getAsset('themeIcon2', { anchorX: 0.5, anchorY: 0.5 })); shape.width = 80 + Math.random() * 120; shape.height = shape.width; shape.x = Math.random() * 2048; shape.y = Math.random() * 2732; shape.alpha = 0.05 + Math.random() * 0.15; shape.tint = 0x9b59b6; // Purple tint shape.rotation = Math.random() * Math.PI * 2; backgroundShapes.push(shape); // Add slow rotation and scaling animation function createShapeAnimation(sh) { var targetScale = 0.8 + Math.random() * 0.4; var rotationDirection = Math.random() > 0.5 ? 1 : -1; tween(sh, { scaleX: targetScale, scaleY: targetScale, rotation: sh.rotation + Math.PI * rotationDirection }, { duration: 6000 + Math.random() * 3000, easing: tween.easeInOut, onFinish: function onFinish() { createShapeAnimation(sh); } }); } createShapeAnimation(shape); }, shape; for (var s = 0; s < 8; s++) { _loop2(); } // Create subtle gradient effect with overlapping circles var _loop3 = function _loop3() { circle = game.addChild(LK.getAsset('themeIcon3', { anchorX: 0.5, anchorY: 0.5 })); circle.width = 300 + Math.random() * 400; circle.height = circle.width; circle.x = Math.random() * 2048; circle.y = Math.random() * 2732; circle.alpha = 0.02 + Math.random() * 0.05; circle.tint = 0x1abc9c; // Teal tint // Add very slow pulsing animation function createPulseAnimation(circ) { var targetScale = 0.7 + Math.random() * 0.6; tween(circ, { scaleX: targetScale, scaleY: targetScale, alpha: circ.alpha * 0.5 }, { duration: 12000 + Math.random() * 6000, easing: tween.easeInOut, onFinish: function onFinish() { tween(circ, { scaleX: 1, scaleY: 1, alpha: circ.alpha * 2 }, { duration: 12000 + Math.random() * 6000, easing: tween.easeInOut, onFinish: function onFinish() { createPulseAnimation(circ); } }); } }); } createPulseAnimation(circle); }, circle; for (var c = 0; c < 5; c++) { _loop3(); } // Make sure background elements are behind game elements questionDisplay.parent.setChildIndex(questionDisplay, questionDisplay.parent.children.length - 1); answerButton1.parent.setChildIndex(answerButton1, answerButton1.parent.children.length - 1); answerButton2.parent.setChildIndex(answerButton2, answerButton2.parent.children.length - 1); answerButton3.parent.setChildIndex(answerButton3, answerButton3.parent.children.length - 1); answerButton4.parent.setChildIndex(answerButton4, answerButton4.parent.children.length - 1); // Start first question after UI animations LK.setTimeout(function () { showNextQuestion(); startQuestionFloating(); }, 500); ;
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var AnswerButton = Container.expand(function () {
var self = Container.call(this);
self.isCorrect = false;
self.answered = false;
self.answerIndex = 0;
// Button background
self.buttonBg = self.attachAsset('answerButton', {
anchorX: 0.5,
anchorY: 0.5
});
// Answer text
self.answerText = new Text2('', {
size: 60,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 750
});
self.answerText.anchor.set(0.5, 0.5);
self.addChild(self.answerText);
self.setAnswer = function (text, correct, index) {
self.answerText.setText(text);
self.isCorrect = correct;
self.answerIndex = index || 0;
};
self.showCorrect = function () {
self.removeChild(self.buttonBg);
self.buttonBg = self.attachAsset('correctButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.buttonBg, 0);
};
self.showWrong = function () {
self.removeChild(self.buttonBg);
self.buttonBg = self.attachAsset('wrongButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.buttonBg, 0);
};
self.move = function (x, y, obj) {
if (self.answered) return;
// Add subtle hover effect
if (!self.isHovering) {
self.isHovering = true;
LK.getSound('hover').play();
tween(self, {
scaleX: 1.05,
scaleY: 1.05
}, {
duration: 150,
easing: tween.easeOut
});
}
};
self.up = function (x, y, obj) {
// Remove hover effect when touch/mouse is released
if (self.isHovering) {
self.isHovering = false;
if (!self.answered) {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 150,
easing: tween.easeOut
});
}
}
};
self.down = function (x, y, obj) {
if (self.answered || answered) return;
self.answered = true;
answered = true;
LK.getSound('click').play();
// Mark all buttons as answered to prevent multiple presses
var allButtons = [answerButton1, answerButton2, answerButton3, answerButton4];
for (var ab = 0; ab < allButtons.length; ab++) {
if (allButtons[ab]) {
allButtons[ab].answered = true;
}
}
// Add press animation
tween(self, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.bounceOut
});
}
});
if (self.isCorrect) {
// Correct answer
self.showCorrect();
LK.effects.flashObject(self, 0x27ae60, 500);
LK.getSound('correct').play();
// Calculate points based on difficulty
var currentQuestion = mixedQuestions[currentQuestionIndex - 1];
var points = 1; // Default points for easy questions
if (currentQuestion.answers.length === 4) {
points = 4; // Super difficulty (4 answers) gives 4 points
} else if (currentQuestion.special) {
points = 2; // Hard difficulty (special questions) gives 2 points
}
LK.setScore(LK.getScore() + points);
scoreTxt.setText(LK.getScore());
// Check if this is a super health question for healing
if (currentQuestion.category === "health" && currentQuestion.answers.length === 4) {
// Super health questions heal the player
if (lives < 3) {
lives++;
livesTxt.setText('Lives: ' + lives);
// Add healing animation with green heart effect
tween(livesTxt, {
scaleX: 1.4,
scaleY: 1.4,
tint: 0x27ae60
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(livesTxt, {
scaleX: 1,
scaleY: 1,
tint: 0xffffff
}, {
duration: 400,
easing: tween.bounceOut
});
}
});
// Create healing particle effects
for (var h = 0; h < 12; h++) {
var healParticle = game.addChild(new Particle());
var globalPos = self.parent.toGlobal(self.position);
healParticle.animate(globalPos.x, globalPos.y);
healParticle.particle.tint = 0x27ae60; // Green healing color
}
}
}
// Create particle celebration effect
for (var p = 0; p < 8; p++) {
var particle = game.addChild(new Particle());
var globalPos = self.parent.toGlobal(self.position);
particle.animate(globalPos.x, globalPos.y);
}
// Add score celebration animation with green color and jump effect
tween(scoreTxt, {
scaleX: 1.3,
scaleY: 1.3,
tint: 0x27ae60,
y: scoreTxt.y - 30
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(scoreTxt, {
scaleX: 1,
scaleY: 1,
tint: 0xFFFFFF,
y: scoreTxt.y + 30
}, {
duration: 300,
easing: tween.bounceOut
});
}
});
// Show next question after delay
LK.setTimeout(function () {
showNextQuestion();
}, 1000);
} else {
// Wrong answer
self.showWrong();
LK.effects.flashObject(self, 0xe74c3c, 500);
LK.effects.flashScreen(0xe74c3c, 1000);
LK.getSound('wrong').play();
// Show correct answer for all buttons
var allButtons = [answerButton1, answerButton2, answerButton3, answerButton4];
for (var b = 0; b < allButtons.length; b++) {
if (allButtons[b] && allButtons[b].isCorrect) {
allButtons[b].showCorrect();
}
}
// Lose a life
lives--;
livesTxt.setText('Lives: ' + lives);
// Add life loss animation with breathing effect
tween(livesTxt, {
scaleX: 1.4,
scaleY: 1.4,
tint: 0xff0000
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
// Create breathing effect for low lives
function breatheEffect() {
if (lives <= 1) {
tween(livesTxt, {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(livesTxt, {
scaleX: 1,
scaleY: 1
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: breatheEffect
});
}
});
}
}
tween(livesTxt, {
scaleX: 1,
scaleY: 1,
tint: 0xffffff
}, {
duration: 400,
easing: tween.easeOut,
onFinish: breatheEffect
});
}
});
// Check if game over or continue
LK.setTimeout(function () {
if (lives <= 0) {
LK.showGameOver();
} else {
showNextQuestion();
}
}, 2000);
}
};
return self;
});
var Particle = Container.expand(function () {
var self = Container.call(this);
self.particle = self.attachAsset('themeIcon1', {
anchorX: 0.5,
anchorY: 0.5
});
self.particle.width = 20;
self.particle.height = 20;
self.particle.tint = 0xFFD700;
self.animate = function (targetX, targetY) {
// Random velocity and angle
var angle = Math.random() * Math.PI * 2;
var speed = 150 + Math.random() * 300;
var vx = Math.cos(angle) * speed;
var vy = Math.sin(angle) * speed;
self.x = targetX;
self.y = targetY;
// Add random colors for more vibrant effects
var colors = [0xFFD700, 0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0x96CEB4, 0xFECA57, 0xFF9FF3, 0x54A0FF];
self.particle.tint = colors[Math.floor(Math.random() * colors.length)];
// Add rotation animation
var rotationSpeed = (Math.random() - 0.5) * 10;
// Animate particle with enhanced physics-like motion
tween(self, {
x: self.x + vx,
y: self.y + vy,
alpha: 0,
scaleX: 0.1,
scaleY: 0.1,
rotation: rotationSpeed
}, {
duration: 1200 + Math.random() * 800,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
// Add a secondary tween for size pulsing during flight
tween(self.particle, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self.particle, {
scaleX: 1,
scaleY: 1
}, {
duration: 400,
easing: tween.easeOut
});
}
});
};
return self;
});
var Question = Container.expand(function () {
var self = Container.call(this);
// Question background
var questionBg = self.attachAsset('questionBox', {
anchorX: 0.5,
anchorY: 0.5
});
// Category icon
self.categoryIcon = null;
// Category text
self.categoryText = null;
// Question text
self.questionText = new Text2('', {
size: 80,
fill: 0xFFFFFF,
wordWrap: true,
wordWrapWidth: 1500
});
self.questionText.anchor.set(0.5, 0.5);
self.questionText.x = 100; // Offset to make room for icon
self.addChild(self.questionText);
self.setQuestion = function (text, category, isSpecial, answerCount) {
self.questionText.setText(text);
// Determine difficulty level based on question length, special status, and answer count
var difficulty = 'Easy';
var difficultyColor = 0x27ae60; // Green for easy
if (answerCount === 4) {
difficulty = 'Super';
difficultyColor = 0xe74c3c; // Red for super difficulty (4 answers)
} else if (isSpecial) {
difficulty = 'Hard';
difficultyColor = 0xe74c3c; // Red for hard
} else if (text.length > 100) {
difficulty = 'Medium';
difficultyColor = 0xf39c12; // Orange for medium
}
// Remove existing category icon if any
if (self.categoryIcon) {
self.removeChild(self.categoryIcon);
}
// Add new category icon
var iconAsset = category + 'Icon';
self.categoryIcon = self.attachAsset(iconAsset, {
anchorX: 0.5,
anchorY: 0.5
});
self.categoryIcon.x = -700; // Position to the left of text
self.categoryIcon.y = -50;
// Add pulsing animation to category icon
function pulseIcon() {
tween(self.categoryIcon, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.categoryIcon, {
scaleX: 1,
scaleY: 1
}, {
duration: 1000,
easing: tween.easeInOut,
onFinish: pulseIcon
});
}
});
}
pulseIcon();
// Add special question indicator
if (isSpecial && (difficulty === 'Hard' || difficulty === 'Super')) {
// Gold tint for special questions
// Add rainbow cycling animation for difficult and super questions only
var cycleSpecialColors = function cycleSpecialColors() {
var colors = [0xFFD700, 0xFF6B6B, 0x4ECDC4, 0x45B7D1, 0x96CEB4, 0xFECA57];
var currentColorIndex = 0;
function nextColor() {
currentColorIndex = (currentColorIndex + 1) % colors.length;
tween(self.categoryIcon, {
tint: colors[currentColorIndex]
}, {
duration: 800,
easing: tween.easeInOut,
onFinish: nextColor
});
}
nextColor();
};
self.categoryIcon.tint = 0xFFD700;
cycleSpecialColors();
} else if (isSpecial) {
// For easy special questions, just use gold tint without rainbow animation
self.categoryIcon.tint = 0xFFD700;
}
// Add category name text
if (self.categoryText) {
self.removeChild(self.categoryText);
}
var categoryDisplayText = category.charAt(0).toUpperCase() + category.slice(1);
if (isSpecial) {
categoryDisplayText += " ★";
}
categoryDisplayText += " (" + difficulty + ")";
self.categoryText = new Text2(categoryDisplayText, {
size: 40,
fill: isSpecial ? 0xFFD700 : difficultyColor
});
self.categoryText.anchor.set(0.5, 0.5);
self.categoryText.x = -700; // Same x as icon
self.categoryText.y = 50; // Below the icon
self.addChild(self.categoryText);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xFFB366
});
/****
* Game Code
****/
var questions = [{
question: "The Sun is a star.",
answers: ["True", "False"],
correct: 0,
category: "science"
}, {
question: "Penguins can fly.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "What is the largest plant in the world?",
answers: ["A Redwood Tree", "The General Sherman Tree"],
correct: 1,
category: "nature",
special: true
}, {
question: "Water boils at 100°C at sea level.",
answers: ["True", "False"],
correct: 0,
category: "science"
}, {
question: "The Great Wall of China is visible from space.",
answers: ["True", "False"],
correct: 1,
category: "geography"
}, {
question: "Which planet is closest to the Sun?",
answers: ["Venus", "Mercury"],
correct: 1,
category: "science",
special: true
}, {
question: "Sharks are mammals.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "Lightning never strikes the same place twice.",
answers: ["True", "False"],
correct: 1,
category: "science"
}, {
question: "What is the smallest country in the world?",
answers: ["Monaco", "Vatican City"],
correct: 1,
category: "geography",
special: true
}, {
question: "Goldfish have a 3-second memory.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "Bananas are berries.",
answers: ["True", "False"],
correct: 0,
category: "nature"
}, {
question: "What is the deepest ocean trench?",
answers: ["Puerto Rico Trench", "Mariana Trench"],
correct: 1,
category: "geography",
special: true
}, {
question: "The human body has 206 bones.",
answers: ["True", "False"],
correct: 0,
category: "science"
}, {
question: "Mount Everest is the tallest mountain on Earth.",
answers: ["True", "False"],
correct: 0,
category: "geography"
}, {
question: "Which mammal is known to have the most powerful bite?",
answers: ["Lion", "Hippopotamus"],
correct: 1,
category: "nature",
special: true
}, {
question: "Octopuses have three hearts.",
answers: ["True", "False"],
correct: 0,
category: "nature"
}, {
question: "The Earth is flat.",
answers: ["True", "False"],
correct: 1,
category: "geography"
}, {
question: "What is the hardest natural substance on Earth?",
answers: ["Titanium", "Diamond"],
correct: 1,
category: "science",
special: true
}, {
question: "Honey never spoils.",
answers: ["True", "False"],
correct: 0,
category: "general"
}, {
question: "Humans only use 10% of their brain.",
answers: ["True", "False"],
correct: 1,
category: "science"
}, {
question: "The Moon has its own light.",
answers: ["True", "False"],
correct: 1,
category: "science"
}, {
question: "Spiders are insects.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "The Sahara is the largest desert in the world.",
answers: ["True", "False"],
correct: 1,
category: "geography"
}, {
question: "All birds can fly.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "The Statue of Liberty was a gift from France.",
answers: ["True", "False"],
correct: 0,
category: "history"
}, {
question: "Fish can drown in water.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "Antarctica is the coldest continent.",
answers: ["True", "False"],
correct: 0,
category: "geography"
}, {
question: "Dolphins are fish.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "The Amazon River is longer than the Nile River.",
answers: ["True", "False"],
correct: 0,
category: "geography"
}, {
question: "Glass is a liquid.",
answers: ["True", "False"],
correct: 1,
category: "science"
}, {
question: "Crocodiles are older than dinosaurs.",
answers: ["True", "False"],
correct: 0,
category: "history"
}, {
question: "The human heart has four chambers.",
answers: ["True", "False"],
correct: 0,
category: "science"
}, {
question: "Which was invented first?",
answers: ["The wheel", "Sliced bread"],
correct: 0,
category: "history",
special: true
}, {
question: "What causes thunder?",
answers: ["Lightning heating air", "Clouds colliding"],
correct: 0,
category: "science",
special: true
}, {
question: "Which animal sleeps the most per day?",
answers: ["Sloth", "Koala"],
correct: 1,
category: "nature",
special: true
}, {
question: "What is the most spoken language in the world?",
answers: ["English", "Mandarin Chinese"],
correct: 1,
category: "general",
special: true
}, {
question: "Which ocean is the largest?",
answers: ["Atlantic Ocean", "Pacific Ocean"],
correct: 1,
category: "geography",
special: true
}, {
question: "What is the fastest land animal?",
answers: ["Cheetah", "Pronghorn Antelope"],
correct: 0,
category: "nature",
special: true
}, {
question: "A group of lions is called a pride.",
answers: ["True", "False"],
correct: 0,
category: "nature"
}, {
question: "The human brain uses about 20% of the body's total energy.",
answers: ["True", "False"],
correct: 0,
category: "science"
}, {
question: "Australia is both a country and a continent.",
answers: ["True", "False"],
correct: 0,
category: "geography"
}, {
question: "Bats are blind.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "The Eiffel Tower can be 15 cm taller during summer.",
answers: ["True", "False"],
correct: 0,
category: "science"
}, {
question: "Russia spans 11 time zones.",
answers: ["True", "False"],
correct: 0,
category: "geography"
}, {
question: "Butterflies taste with their feet.",
answers: ["True", "False"],
correct: 0,
category: "nature"
}, {
question: "Sound travels faster in water than in air.",
answers: ["True", "False"],
correct: 0,
category: "science"
}, {
question: "The Pacific Ring of Fire is a major area of earthquake activity.",
answers: ["True", "False"],
correct: 0,
category: "geography"
}, {
question: "Elephants are afraid of mice.",
answers: ["True", "False"],
correct: 1,
category: "nature"
}, {
question: "Which gas makes up most of Earth's atmosphere?",
answers: ["Oxygen", "Nitrogen"],
correct: 1,
category: "science",
special: true
}, {
question: "What is the most abundant metal in Earth's crust?",
answers: ["Iron", "Aluminum"],
correct: 1,
category: "science",
special: true
}, {
question: "Which bird can fly backwards?",
answers: ["Hummingbird", "Swift"],
correct: 0,
category: "nature",
special: true
}, {
question: "What is the longest river in Europe?",
answers: ["Danube", "Volga"],
correct: 1,
category: "geography",
special: true
}, {
question: "Which planet has the most moons?",
answers: ["Jupiter", "Saturn"],
correct: 1,
category: "science",
special: true
}, {
question: "What percentage of the human body is water?",
answers: ["About 60%", "About 80%"],
correct: 0,
category: "science",
special: true
}, {
question: "Which country has the most natural lakes?",
answers: ["Canada", "Finland"],
correct: 0,
category: "geography",
special: true
}, {
question: "What is the only mammal capable of true flight?",
answers: ["Flying squirrel", "Bat"],
correct: 1,
category: "nature",
special: true
}, {
question: "Which chemical element has the atomic number 1?",
answers: ["Helium", "Hydrogen", "Lithium", "Carbon"],
correct: 1,
category: "science",
special: true,
difficulty: "extra"
}, {
question: "What is the capital of Kazakhstan?",
answers: ["Almaty", "Nur-Sultan", "Shymkent", "Astana"],
correct: 1,
category: "geography",
special: true,
difficulty: "extra"
}, {
question: "Which author wrote 'One Hundred Years of Solitude'?",
answers: ["Mario Vargas Llosa", "Gabriel García Márquez", "Jorge Luis Borges", "Octavio Paz"],
correct: 1,
category: "general",
special: true,
difficulty: "extra"
}, {
question: "What is the smallest unit of matter that retains the properties of an element?",
answers: ["Molecule", "Atom", "Electron", "Proton"],
correct: 1,
category: "science",
special: true,
difficulty: "extra"
}, {
question: "Which dynasty ruled China for the longest period?",
answers: ["Ming Dynasty", "Qing Dynasty", "Zhou Dynasty", "Han Dynasty"],
correct: 2,
category: "history",
special: true,
difficulty: "extra"
}, {
question: "What is the process by which plants make their own food?",
answers: ["Respiration", "Photosynthesis", "Transpiration", "Fertilization"],
correct: 1,
category: "nature",
special: true,
difficulty: "extra"
}, {
question: "Which programming language was developed by Guido van Rossum?",
answers: ["Java", "Python", "C++", "JavaScript"],
correct: 1,
category: "science",
special: true,
difficulty: "extra"
}, {
question: "What is the largest organ in the human body?",
answers: ["Liver", "Brain", "Skin", "Lungs"],
correct: 2,
category: "science",
special: true,
difficulty: "extra"
}, {
question: "Tomatoes are vegetables.",
answers: ["True", "False"],
correct: 1,
category: "gastronomy"
}, {
question: "What spice is derived from the Crocus flower?",
answers: ["Paprika", "Saffron"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Chocolate comes from cocoa beans.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "Which country is famous for inventing pasta?",
answers: ["China", "Italy"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Honey is made by bees from flower nectar.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "What is the main ingredient in guacamole?",
answers: ["Lime", "Avocado"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Coffee beans are actually seeds.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "Which herb is commonly used in Italian cuisine?",
answers: ["Basil", "Cilantro"],
correct: 0,
category: "gastronomy",
special: true
}, {
question: "Vanilla is the most expensive spice in the world.",
answers: ["True", "False"],
correct: 1,
category: "gastronomy"
}, {
question: "What type of pastry is used to make profiteroles?",
answers: ["Puff pastry", "Choux pastry"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Mushrooms are vegetables.",
answers: ["True", "False"],
correct: 1,
category: "gastronomy"
}, {
question: "Which cooking method uses dry heat in an oven?",
answers: ["Braising", "Roasting"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Salt enhances the flavor of food.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "What is the main ingredient in traditional hummus?",
answers: ["Lentils", "Chickpeas"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Bread rises because of yeast.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "Which cooking technique involves cooking food in its own fat?",
answers: ["Confit", "Sauté"],
correct: 0,
category: "gastronomy",
special: true
}, {
question: "Olive oil comes from olives.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "What is the French term for 'cooking everything together'?",
answers: ["Mise en place", "Casserole"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Cheese is made from milk.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "Which country is the origin of sushi?",
answers: ["China", "Japan"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Fermentation is used to make wine.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "What is the main ingredient in traditional pesto?",
answers: ["Parsley", "Basil"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Butter is made from cream.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "Which technique involves cooking food slowly in liquid?",
answers: ["Grilling", "Braising"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Eggs are a source of protein.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "What is the most consumed beverage in the world after water?",
answers: ["Coffee", "Tea"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Caramelization occurs when sugar is heated.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "Which knife cut produces small cubes?",
answers: ["Julienne", "Brunoise"],
correct: 1,
category: "gastronomy",
special: true
}, {
question: "Gelato contains less air than ice cream.",
answers: ["True", "False"],
correct: 0,
category: "gastronomy"
}, {
question: "What is the main ingredient in traditional mayonnaise?",
answers: ["Egg yolks", "Cream", "Butter", "Milk"],
correct: 0,
category: "gastronomy",
special: true,
difficulty: "extra"
}, {
question: "Which cooking method uses moist heat?",
answers: ["Roasting", "Steaming", "Grilling", "Sautéing"],
correct: 1,
category: "gastronomy",
special: true,
difficulty: "extra"
}, {
question: "What is the French culinary term for 'everything in its place'?",
answers: ["Mise en place", "Sous vide", "Confit", "Flambé"],
correct: 0,
category: "gastronomy",
special: true,
difficulty: "extra"
}, {
question: "Which mother sauce is made with a blonde roux and stock?",
answers: ["Béchamel", "Velouté", "Espagnole", "Hollandaise"],
correct: 1,
category: "gastronomy",
special: true,
difficulty: "extra"
}, {
question: "The human heart has four chambers.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "Exercise helps strengthen the cardiovascular system.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "What is the recommended daily water intake for adults?",
answers: ["4 glasses", "8 glasses"],
correct: 1,
category: "health",
special: true
}, {
question: "Smoking damages the lungs.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "Which vitamin is produced by the skin when exposed to sunlight?",
answers: ["Vitamin C", "Vitamin D"],
correct: 1,
category: "health",
special: true
}, {
question: "Sleep is important for mental health.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "What is the normal resting heart rate for adults?",
answers: ["60-100 beats per minute", "100-140 beats per minute"],
correct: 0,
category: "health",
special: true
}, {
question: "Calcium is important for bone health.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "Which organ filters toxins from the blood?",
answers: ["Kidney", "Liver"],
correct: 1,
category: "health",
special: true
}, {
question: "Stress can affect physical health.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "What is the main function of red blood cells?",
answers: ["Fight infection", "Carry oxygen"],
correct: 1,
category: "health",
special: true
}, {
question: "Regular handwashing prevents disease.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "Which nutrient provides the most energy per gram?",
answers: ["Carbohydrates", "Fats"],
correct: 1,
category: "health",
special: true
}, {
question: "Fruits and vegetables are good sources of vitamins.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "What is the medical term for high blood pressure?",
answers: ["Hypotension", "Hypertension"],
correct: 1,
category: "health",
special: true
}, {
question: "Meditation can reduce stress levels.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "Which type of exercise strengthens the heart muscle?",
answers: ["Stretching", "Aerobic exercise"],
correct: 1,
category: "health",
special: true
}, {
question: "The immune system protects against disease.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "What is the body's largest organ?",
answers: ["Liver", "Skin"],
correct: 1,
category: "health",
special: true
}, {
question: "Fiber aids in digestion.",
answers: ["True", "False"],
correct: 0,
category: "health"
}, {
question: "Which mineral is essential for healthy teeth and bones?",
answers: ["Iron", "Calcium", "Zinc", "Magnesium"],
correct: 1,
category: "health",
special: true,
difficulty: "extra"
}, {
question: "What is the recommended amount of sleep for adults?",
answers: ["5-6 hours", "7-9 hours", "10-12 hours", "4-5 hours"],
correct: 1,
category: "health",
special: true,
difficulty: "extra"
}, {
question: "Which part of the brain controls balance and coordination?",
answers: ["Cerebrum", "Cerebellum", "Brain stem", "Hippocampus"],
correct: 1,
category: "health",
special: true,
difficulty: "extra"
}, {
question: "What is the medical term for difficulty sleeping?",
answers: ["Insomnia", "Narcolepsy", "Sleep apnea", "Hypersomnia"],
correct: 0,
category: "health",
special: true,
difficulty: "extra"
}, {
question: "A lever is a simple machine.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "Friction always opposes motion.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "Which simple machine helps lift heavy objects with less force?",
answers: ["Wheel", "Pulley"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Gears can change the direction of force.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "What type of energy is stored in a compressed spring?",
answers: ["Kinetic energy", "Potential energy"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Inertia is the tendency of objects to resist changes in motion.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "Which force pulls objects toward Earth's center?",
answers: ["Magnetism", "Gravity"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "A screw is basically an inclined plane wrapped around a cylinder.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "What happens to the mechanical advantage when you increase the length of a lever arm?",
answers: ["Decreases", "Increases"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Hydraulic systems use liquid pressure to transmit force.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "Which law states that for every action there is an equal and opposite reaction?",
answers: ["Newton's Second Law", "Newton's Third Law"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Ball bearings reduce friction in rotating machinery.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "What is the mechanical advantage of a fixed pulley?",
answers: ["Greater than 1", "Equal to 1"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Torque is a measure of rotational force.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "Which type of gear system increases speed but decreases torque?",
answers: ["Large gear driving small gear", "Small gear driving large gear"],
correct: 0,
category: "mechanics",
special: true
}, {
question: "Momentum is conserved in collisions.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "What is the unit of measurement for force?",
answers: ["Watt", "Newton"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Centripetal force acts toward the center of circular motion.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "Which principle explains how airplanes generate lift?",
answers: ["Archimedes' Principle", "Bernoulli's Principle"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Elastic materials return to their original shape after deformation.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "What determines the period of a pendulum's swing?",
answers: ["Mass of the bob", "Length of the string"],
correct: 1,
category: "mechanics",
special: true
}, {
question: "Kinetic energy increases with the square of velocity.",
answers: ["True", "False"],
correct: 0,
category: "mechanics"
}, {
question: "Which type of mechanical joint allows rotation in multiple directions?",
answers: ["Hinge joint", "Ball joint", "Pin joint", "Universal joint"],
correct: 3,
category: "mechanics",
special: true,
difficulty: "extra"
}, {
question: "What is the efficiency formula for a machine?",
answers: ["Input/Output × 100%", "Output/Input × 100%", "Work/Energy × 100%", "Force/Distance × 100%"],
correct: 1,
category: "mechanics",
special: true,
difficulty: "extra"
}, {
question: "Which type of stress occurs when forces try to stretch a material?",
answers: ["Compression", "Tension", "Shear", "Torsion"],
correct: 1,
category: "mechanics",
special: true,
difficulty: "extra"
}, {
question: "What is the relationship between pressure, force, and area?",
answers: ["P = F × A", "P = F / A", "P = A / F", "P = F + A"],
correct: 1,
category: "mechanics",
special: true,
difficulty: "extra"
}, {
question: "Movies are also called films.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Charlie Chaplin was a famous silent film actor.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which film won the first Academy Award for Best Picture?",
answers: ["Sunrise", "Wings"],
correct: 1,
category: "cinema",
special: true
}, {
question: "Alfred Hitchcock was known as the 'Master of Suspense'.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which director created the movie 'Jaws'?",
answers: ["George Lucas", "Steven Spielberg"],
correct: 1,
category: "cinema",
special: true
}, {
question: "The first color movie was made in the 1930s.",
answers: ["True", "False"],
correct: 1,
category: "cinema"
}, {
question: "Which movie features the famous line 'May the Force be with you'?",
answers: ["Star Trek", "Star Wars"],
correct: 1,
category: "cinema",
special: true
}, {
question: "Animation movies are made using computer graphics only.",
answers: ["True", "False"],
correct: 1,
category: "cinema"
}, {
question: "Which film studio created Mickey Mouse?",
answers: ["Warner Bros", "Disney"],
correct: 1,
category: "cinema",
special: true
}, {
question: "The movie 'Titanic' was based on a true story.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which actor played the character of Jack Sparrow?",
answers: ["Orlando Bloom", "Johnny Depp"],
correct: 1,
category: "cinema",
special: true
}, {
question: "Movie theaters show films on large screens.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which movie series features wizards and magic?",
answers: ["Lord of the Rings", "Harry Potter"],
correct: 1,
category: "cinema",
special: true
}, {
question: "Directors are responsible for making movies.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which movie won the Academy Award for Best Picture in 1994?",
answers: ["The Lion King", "Forrest Gump"],
correct: 1,
category: "cinema",
special: true
}, {
question: "Special effects make impossible things look real in movies.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which director is known for the movie 'E.T.'?",
answers: ["James Cameron", "Steven Spielberg"],
correct: 1,
category: "cinema",
special: true
}, {
question: "Movie scripts tell actors what to say and do.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which movie features a young lion named Simba?",
answers: ["Jungle Book", "The Lion King"],
correct: 1,
category: "cinema",
special: true
}, {
question: "Soundtracks enhance the emotional impact of movies.",
answers: ["True", "False"],
correct: 0,
category: "cinema"
}, {
question: "Which film director created the movie 'Psycho'?",
answers: ["Alfred Hitchcock", "Stanley Kubrick", "Martin Scorsese", "Francis Ford Coppola"],
correct: 0,
category: "cinema",
special: true,
difficulty: "extra"
}, {
question: "What does the term 'cinematography' refer to?",
answers: ["Sound recording", "Camera work and visual composition", "Script writing", "Acting techniques"],
correct: 1,
category: "cinema",
special: true,
difficulty: "extra"
}, {
question: "Which movie won the Academy Award for Best Picture in 1972?",
answers: ["The Godfather", "Cabaret", "Deliverance", "Sounder"],
correct: 0,
category: "cinema",
special: true,
difficulty: "extra"
}, {
question: "What is the standard frame rate for most movies?",
answers: ["24 fps", "30 fps", "60 fps", "120 fps"],
correct: 0,
category: "cinema",
special: true,
difficulty: "extra"
}];
var currentQuestionIndex = 0;
var answered = false;
var lives = 3;
var questionsAnswered = 0;
var nextSpecialQuestionAt = 3; // First special question after 3 questions
// Score display
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Lives display
var livesTxt = new Text2('Lives: 3', {
size: 80,
fill: 0xFFFFFF
});
livesTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(livesTxt);
// Progress indicator
var progressTxt = new Text2('Question 1', {
size: 60,
fill: 0xFFFFFF
});
progressTxt.anchor.set(0, 0);
progressTxt.x = 120; // Avoid top-left menu area
progressTxt.y = 20;
LK.gui.topLeft.addChild(progressTxt);
// Question display
var questionDisplay = game.addChild(new Question());
questionDisplay.x = 2048 / 2;
questionDisplay.y = 800;
// Answer buttons
var answerButton1 = game.addChild(new AnswerButton());
answerButton1.x = 2048 / 2 - 450;
answerButton1.y = 1500;
var answerButton2 = game.addChild(new AnswerButton());
answerButton2.x = 2048 / 2 + 450;
answerButton2.y = 1500;
var answerButton3 = game.addChild(new AnswerButton());
answerButton3.x = 2048 / 2 - 450;
answerButton3.y = 1750;
var answerButton4 = game.addChild(new AnswerButton());
answerButton4.x = 2048 / 2 + 450;
answerButton4.y = 1750;
function showNextQuestion() {
// Check if we need to generate more questions
if (mixedQuestions.length <= currentQuestionIndex) {
// Check if we have questions left to add
if (regularIndex >= regularQuestions.length && specialIndex >= specialQuestions.length) {
// Player completed all questions - they win!
LK.showYouWin();
return;
}
// Determine if next question should be special
var shouldShowSpecial = questionsAnswered >= nextSpecialQuestionAt && specialIndex < specialQuestions.length;
if (shouldShowSpecial) {
// Add special question
mixedQuestions.push(specialQuestions[specialIndex]);
specialIndex++;
// Schedule next special question randomly (every 2-4 questions)
nextSpecialQuestionAt = questionsAnswered + 2 + Math.floor(Math.random() * 3);
} else if (regularIndex < regularQuestions.length) {
// Add regular question
mixedQuestions.push(regularQuestions[regularIndex]);
regularIndex++;
} else {
// Only special questions left
mixedQuestions.push(specialQuestions[specialIndex]);
specialIndex++;
}
}
var question = mixedQuestions[currentQuestionIndex];
// Reset button states
answered = false;
var allButtons = [answerButton1, answerButton2, answerButton3, answerButton4];
for (var b = 0; b < allButtons.length; b++) {
if (allButtons[b]) {
allButtons[b].answered = false;
allButtons[b].removeChild(allButtons[b].buttonBg);
allButtons[b].buttonBg = allButtons[b].attachAsset('answerButton', {
anchorX: 0.5,
anchorY: 0.5
});
allButtons[b].addChildAt(allButtons[b].buttonBg, 0);
}
}
// Update progress indicator
var totalQuestions = Math.min(questions.length, 20); // Limit display to reasonable number
progressTxt.setText('Question ' + Math.min(questionsAnswered, totalQuestions));
// Set question and answers
questionDisplay.setQuestion(question.question, question.category, question.special, question.answers.length);
var is4Answer = question.answers.length === 4;
// Set answers for all buttons
answerButton1.setAnswer(question.answers[0], question.correct === 0, 0);
answerButton2.setAnswer(question.answers[1], question.correct === 1, 1);
// Handle 4-answer questions
if (is4Answer) {
answerButton3.setAnswer(question.answers[2], question.correct === 2, 2);
answerButton4.setAnswer(question.answers[3], question.correct === 3, 3);
answerButton3.visible = true;
answerButton4.visible = true;
// Adjust positions for 4-answer layout
answerButton1.y = 1500;
answerButton2.y = 1500;
answerButton3.y = 1750;
answerButton4.y = 1750;
} else {
// Hide buttons 3 and 4 for 2-answer questions
answerButton3.visible = false;
answerButton4.visible = false;
// Adjust positions for 2-answer layout
answerButton1.y = 1600;
answerButton2.y = 1600;
}
// Reset hover states
answerButton1.isHovering = false;
answerButton2.isHovering = false;
answerButton3.isHovering = false;
answerButton4.isHovering = false;
// Animate elements entrance
questionDisplay.alpha = 0;
questionDisplay.scaleX = 0.5;
questionDisplay.scaleY = 0.5;
tween(questionDisplay, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 600,
easing: tween.easeOut
});
// Animate all visible buttons with staggered entrance
var buttonsToAnimate = [answerButton1, answerButton2];
if (is4Answer) {
buttonsToAnimate.push(answerButton3, answerButton4);
}
for (var b = 0; b < buttonsToAnimate.length; b++) {
var button = buttonsToAnimate[b];
if (button && button.visible) {
button.alpha = 0;
button.scaleX = 0.3;
button.scaleY = 0.3;
var targetY = button.y;
button.y = targetY + 300;
button.rotation = Math.PI * 0.5; // Start rotated
tween(button, {
alpha: 1,
y: targetY,
scaleX: 1,
scaleY: 1,
rotation: 0
}, {
duration: 600 + b * 150,
easing: tween.bounceOut
});
}
}
currentQuestionIndex++;
questionsAnswered++;
}
// Separate questions into regular and special arrays
var regularQuestions = [];
var specialQuestions = [];
for (var i = 0; i < questions.length; i++) {
if (questions[i].special) {
specialQuestions.push(questions[i]);
} else {
regularQuestions.push(questions[i]);
}
}
// Shuffle both arrays
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
shuffleArray(regularQuestions);
shuffleArray(specialQuestions);
// Create mixed question sequence
var mixedQuestions = [];
var regularIndex = 0;
var specialIndex = 0;
// Start the game with entrance animations
scoreTxt.setText(LK.getScore());
// Initial setup - hide elements for entrance animation
questionDisplay.alpha = 0;
answerButton1.alpha = 0;
answerButton2.alpha = 0;
answerButton3.alpha = 0;
answerButton4.alpha = 0;
answerButton3.visible = false;
answerButton4.visible = false;
// Animate score text entrance
scoreTxt.y = -100;
tween(scoreTxt, {
y: 0
}, {
duration: 800,
easing: tween.bounceOut
});
// Animate lives text entrance
livesTxt.y = -100;
tween(livesTxt, {
y: 0
}, {
duration: 900,
easing: tween.bounceOut
});
// Play background music
LK.playMusic('FALSEorTRUE');
// Add floating animation to question display
function startQuestionFloating() {
tween(questionDisplay, {
y: questionDisplay.y - 20
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(questionDisplay, {
y: questionDisplay.y + 20
}, {
duration: 2000,
easing: tween.easeInOut,
onFinish: startQuestionFloating
});
}
});
}
// Create animated background elements
var backgroundParticles = [];
var backgroundShapes = [];
// Create floating background particles
var _loop = function _loop() {
particle = game.addChild(LK.getAsset('themeIcon1', {
anchorX: 0.5,
anchorY: 0.5
}));
particle.width = 30 + Math.random() * 50;
particle.height = particle.width;
particle.x = Math.random() * 2048;
particle.y = Math.random() * 2732;
particle.alpha = 0.1 + Math.random() * 0.2;
particle.tint = 0x3498db; // Light blue tint
backgroundParticles.push(particle);
// Add floating animation
function createFloatingAnimation(p) {
var targetX = Math.random() * 2048;
var targetY = Math.random() * 2732;
var duration = 8000 + Math.random() * 4000;
tween(p, {
x: targetX,
y: targetY,
rotation: p.rotation + Math.PI * 2
}, {
duration: duration,
easing: tween.easeInOut,
onFinish: function onFinish() {
createFloatingAnimation(p);
}
});
}
createFloatingAnimation(particle);
},
particle;
for (var p = 0; p < 15; p++) {
_loop();
}
// Create geometric background shapes
var _loop2 = function _loop2() {
shape = game.addChild(LK.getAsset('themeIcon2', {
anchorX: 0.5,
anchorY: 0.5
}));
shape.width = 80 + Math.random() * 120;
shape.height = shape.width;
shape.x = Math.random() * 2048;
shape.y = Math.random() * 2732;
shape.alpha = 0.05 + Math.random() * 0.15;
shape.tint = 0x9b59b6; // Purple tint
shape.rotation = Math.random() * Math.PI * 2;
backgroundShapes.push(shape);
// Add slow rotation and scaling animation
function createShapeAnimation(sh) {
var targetScale = 0.8 + Math.random() * 0.4;
var rotationDirection = Math.random() > 0.5 ? 1 : -1;
tween(sh, {
scaleX: targetScale,
scaleY: targetScale,
rotation: sh.rotation + Math.PI * rotationDirection
}, {
duration: 6000 + Math.random() * 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
createShapeAnimation(sh);
}
});
}
createShapeAnimation(shape);
},
shape;
for (var s = 0; s < 8; s++) {
_loop2();
}
// Create subtle gradient effect with overlapping circles
var _loop3 = function _loop3() {
circle = game.addChild(LK.getAsset('themeIcon3', {
anchorX: 0.5,
anchorY: 0.5
}));
circle.width = 300 + Math.random() * 400;
circle.height = circle.width;
circle.x = Math.random() * 2048;
circle.y = Math.random() * 2732;
circle.alpha = 0.02 + Math.random() * 0.05;
circle.tint = 0x1abc9c; // Teal tint
// Add very slow pulsing animation
function createPulseAnimation(circ) {
var targetScale = 0.7 + Math.random() * 0.6;
tween(circ, {
scaleX: targetScale,
scaleY: targetScale,
alpha: circ.alpha * 0.5
}, {
duration: 12000 + Math.random() * 6000,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(circ, {
scaleX: 1,
scaleY: 1,
alpha: circ.alpha * 2
}, {
duration: 12000 + Math.random() * 6000,
easing: tween.easeInOut,
onFinish: function onFinish() {
createPulseAnimation(circ);
}
});
}
});
}
createPulseAnimation(circle);
},
circle;
for (var c = 0; c < 5; c++) {
_loop3();
}
// Make sure background elements are behind game elements
questionDisplay.parent.setChildIndex(questionDisplay, questionDisplay.parent.children.length - 1);
answerButton1.parent.setChildIndex(answerButton1, answerButton1.parent.children.length - 1);
answerButton2.parent.setChildIndex(answerButton2, answerButton2.parent.children.length - 1);
answerButton3.parent.setChildIndex(answerButton3, answerButton3.parent.children.length - 1);
answerButton4.parent.setChildIndex(answerButton4, answerButton4.parent.children.length - 1);
// Start first question after UI animations
LK.setTimeout(function () {
showNextQuestion();
startQuestionFloating();
}, 500);
;
Long Burton. In-Game asset. 2d. High contrast. No shadows
Long button. In-Game asset. 2d. High contrast. No shadows
Long, shiny green button. In-Game asset. 2d. High contrast. No shadows
Long Bright red button. In-Game asset. 2d. High contrast. No shadows
Science icon. In-Game asset. 2d. High contrast. No shadows
Minimalist nature icon. In-Game asset. 2d. High contrast. No shadows
Minimalist geography icon. In-Game asset. 2d. High contrast. No shadows
Minimalist icon for general topics. In-Game asset. 2d. High contrast. No shadows
Minimalist icon of history. In-Game asset. 2d. High contrast. No shadows
Dark orange circular minimalist roulette. In-Game asset. 2d. High contrast. No shadows
Minimalist medical icon. In-Game asset. 2d. High contrast. No shadows
Minimalist mechanics icon. In-Game asset. 2d. High contrast. No shadows
Minimalist film icon. In-Game asset. 2d. High contrast. No shadows