User prompt
Move sanity points down 50px and right 100px
User prompt
Move sanity meter down 50 pixels
User prompt
When player gets a wrong answer, they lose 1 sanity point. When sanity is 0 show game over.
User prompt
When sanity reaches 0, this is called Sanity Break. Display Sanity break graphic .
User prompt
Add new trivia: Which gas is released when trees are cut down and burned? a. Oxygen b. Carbon dioxide (correct) c. Hydrogen
User prompt
Reduce font size of answers by 10%
User prompt
Add new trivia : What is the major human activity contributing to deforestation and climate change? a. Fishing b. Logging (correct) c. Mining
User prompt
Add new trivia: Which international agreement aims to combat climate change by reducing greenhouse gas emissions? a. Kyoto Protocol b. Paris Agreement (correct) c. Copenhagen Accord
User prompt
Add new trivia question : What is the term for the gradual increase in Earth's average temperature? a. Global cooling b. Global warming (correct) c. Climate stability
User prompt
Add new trivia question: Which renewable energy source generates electricity through the movement of wind? a. Solar b. Wind (correct) c. Hydro
User prompt
Add new trivia question: What is the primary greenhouse gas responsible for climate change? a. Oxygen b. Methane (correct) c. Nitrogen
User prompt
1. Create a new object with the following structure: ```javascript { question: 'Your new trivia question?', answers: ['Answer 1', 'Answer 2', 'Answer 3'], correct: 0 // The index of the correct answer in the answers array } ``` 2. Append this object to the `triviaQuestions` array. You can do this by using the `push` method: ```javascript triviaQuestions.push({ question: 'Your new trivia question?', answers: ['Answer 1', 'Answer 2', 'Answer 3'], correct: 0 // The index of the correct answer in the answers array }); ``` Make sure that the `correct` property holds the index of the correct answer within the `answers` array, starting from 0.
User prompt
Create a white rectangle box behind the sanity meter
User prompt
How do I make the answer button stay but the answer text update?
User prompt
When player andwer lr is incorrect, remove one sanity point icon
User prompt
Replace text for sanity points with icons
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'self.score.toString')' in this line: 'var scoreTxt = new Text2(self.score.toString(), {' Line Number: 253
User prompt
Remove score replace score with sanity points
User prompt
Add sanity points to game.
User prompt
If the player gets three wrong answers show game
User prompt
Fix Bug: 'TypeError: self.getGraphics is not a function. (In 'self.getGraphics()', 'self.getGraphics' is undefined)' in this line: 'self.spawnY = 2732 - self.getGraphics().height * self.sizeMultiplier / 2 - 500;' Line Number: 66
User prompt
Make the initial position of the ghost match the reset position
User prompt
Increase maximum size for ghost to 700%
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'this.puzzle.solve')' in this line: 'this.puzzle.solve(this.ghost);' Line Number: 262
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'this.puzzle.isSolved')' in this line: 'if (this.puzzle.isSolved) {' Line Number: 262
var triviaQuestions = [{ question: 'What is the capital city of Australia?', answers: ['Sydney', 'Canberra', 'Melbourne'], correct: 1 }, { question: 'Who wrote the novel "1984"?', answers: ['George Orwell', 'J.K. Rowling', 'Ernest Hemingway'], correct: 0 }, { question: 'What is the largest mammal in the world?', answers: ['Elephant', 'Blue Whale', 'Giraffe'], correct: 1 }, { question: 'In which year did the Titanic sink?', answers: ['1912', '1923', '1905'], correct: 0 }, { question: 'Which planet is known as the Red Planet?', answers: ['Jupiter', 'Mars', 'Venus'], correct: 1 }, { question: 'Who painted the famous artwork "Starry Night"?', answers: ['Claude Monet', 'Vincent van Gogh', 'Pablo Picasso'], correct: 1 }, { question: 'What is the square root of 64?', answers: ['6', '8', '10'], correct: 1 }, { question: 'What is the main ingredient in guacamole?', answers: ['Tomato', 'Avocado', 'Onion'], correct: 1 }, { question: 'In which country would you find the Great Barrier Reef?', answers: ['Mexico', 'Australia', 'Brazil'], correct: 1 }, { question: 'The Pacific Garbage Patch is an accumulation of marine debris in which ocean?', answers: ['Atlantic Ocean', 'Indian Ocean', 'Pacific Ocean'], correct: 2 }, { question: 'How many Styrofoam cups do Americans throw away every year?', answers: ['15 trillion', '25 trillion', '35 trillion'], correct: 1 }]; var AnswerButton = Container.expand(function (text, index, callback) { var self = Container.call(this); self.index = index; var buttonText = new Text2(text, { size: 64.6, fill: '#000000', font: 'Times New Roman' }); buttonText.anchor.set(0.5, 0.5); var buttonGraphics = self.createAsset('button', 'Answer Button', 0.5, 0.5); self.addChild(buttonGraphics); self.addChild(buttonText); self.on('down', function () { callback(index); }); }); var Ghost = Container.expand(function () { var self = Container.call(this); var ghostGraphics = self.createAsset('ghost', 'Ghost character', .5, .5); self.spawnX = 2048 / 2; self.spawnY = 2732 / 4; self.getGraphics = function () { return ghostGraphics; }; self.sizeMultiplier = 1; self.checkSize = function () { if (self.sizeMultiplier >= 5) { LK.showGameOver(); } }; self.move = function () {}; self.attack = function () {}; self.update = function () { self.sizeMultiplier += 0.005; ghostGraphics.scale.set(self.sizeMultiplier); self.checkSize(); }; }); var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5); self.move = function () {}; self.attack = function () {}; self.update = function () {}; }); var Puzzle = Container.expand(function () { var self = Container.call(this); self.updateQuestionAndAnswers = function () { LK.gui.topCenter.removeChild(self.questionText); this.chosenQuestion = triviaQuestions[Math.floor(Math.random() * triviaQuestions.length)]; self.questionText = new Text2(this.chosenQuestion.question, { size: 68, fill: '#000000', wordWrap: true, wordWrapWidth: 600, font: 'Times New Roman' }); self.questionText.anchor.set(0.5, 0.5); self.questionText.x = 2048 / 4 - 800; self.questionText.y = 2732 / 3 + 550; LK.gui.topCenter.addChild(self.questionText); self.answerButtons.forEach(function (button) { button.destroy(); }); self.answerButtons = []; var buttonHeight = 100; var startY = self.answerButtons.length > 0 ? self.answerButtons[0].y : self.questionText.y + self.questionText.height - 350; var positions = []; for (var i = 0; i < this.chosenQuestion.answers.length; i++) { positions.push(startY + i * (buttonHeight + 50)); } for (var i = 0; i < this.chosenQuestion.answers.length; i++) { (function (index) { var answerButton = new AnswerButton(self.chosenQuestion.answers[index], index, function (buttonIndex) { if (index === self.chosenQuestion.correct) { LK.effects.flashScreen(0xffffff, 500); self.parent.ghost.sizeMultiplier = 1; self.parent.ghost.getGraphics().scale.set(self.parent.ghost.sizeMultiplier); self.parent.ghost.x = self.parent.ghost.spawnX; self.parent.ghost.y = 2732 - self.parent.ghost.getGraphics().height * self.parent.ghost.sizeMultiplier / 2 - 500; self.parent.score += 1; self.updateQuestionAndAnswers(); } else { LK.effects.flashScreen(0xff0000, 500); } }); answerButton.x = 2048 / 2 - 700; answerButton.y = positions[index]; self.answerButtons.push(answerButton); LK.gui.topCenter.addChild(answerButton); })(i); } }; self.answerButtons = []; this.chosenQuestion = triviaQuestions[Math.floor(Math.random() * triviaQuestions.length)]; self.questionText = new Text2(this.chosenQuestion.question, { size: 68, fill: '#000000', wordWrap: true, wordWrapWidth: 600, font: 'Times New Roman' }); self.questionText.anchor.set(0.5, 0.5); self.questionText.x = 2048 / 4 - 800; self.questionText.y = 2732 / 3 + 550; LK.gui.topCenter.addChild(self.questionText); var buttonHeight = 100; var startY = self.questionText.y + self.questionText.height - 350; var positions = []; for (var i = 0; i < self.chosenQuestion.answers.length; i++) { positions.push(startY + i * (buttonHeight + 50)); } for (var i = 0; i < self.chosenQuestion.answers.length; i++) { (function (index) { var answerButton = new AnswerButton(self.chosenQuestion.answers[index], index, function (buttonIndex) { if (index === self.chosenQuestion.correct) { LK.effects.flashScreen(0xffffff, 500); self.parent.ghost.sizeMultiplier = 1; self.parent.ghost.getGraphics().scale.set(self.parent.ghost.sizeMultiplier); self.parent.ghost.x = 2048 / 2; self.parent.ghost.y = 2732 - self.parent.ghost.getGraphics().height * self.parent.ghost.sizeMultiplier / 2 - 500; self.parent.score += 1; self.updateQuestionAndAnswers(); } else { LK.effects.flashScreen(0xff0000, 500); } }); answerButton.x = 2048 / 2 - 700; answerButton.y = positions[index]; self.answerButtons.push(answerButton); LK.gui.topCenter.addChild(answerButton); })(i); } var puzzleGraphics = LK.getAsset('puzzle', 'Puzzle element', .5, .5); self.addChild(puzzleGraphics); self.width = puzzleGraphics.width; self.height = puzzleGraphics.height; self.solve = function (ghost) { self.removeChild(self.questionText); self.answerButtons.forEach(function (button) { button.destroy(); }); self.answerButtons = []; this.chosenQuestion = triviaQuestions[Math.floor(Math.random() * triviaQuestions.length)]; self.questionText = new Text2(this.chosenQuestion.question, { size: 68, fill: '#000000', wordWrap: true, wordWrapWidth: 600, font: 'Times New Roman' }); self.questionText.anchor.set(0.5, 0.5); self.questionText.x = 2048 / 4 - 800; self.questionText.y = 2732 / 3 + 550; LK.gui.topCenter.addChild(self.questionText); var buttonHeight = 100; var startY = self.questionText.y + self.questionText.height - 350; var positions = []; for (var i = 0; i < self.chosenQuestion.answers.length; i++) { positions.push(startY + i * (buttonHeight + 50)); } for (var i = 0; i < self.chosenQuestion.answers.length; i++) { (function (index) { var answerButton = new AnswerButton(self.chosenQuestion.answers[index], index, function (buttonIndex) { if (index === self.chosenQuestion.correct) { LK.effects.flashScreen(0xffffff, 500); self.parent.ghost.sizeMultiplier = 1; self.parent.ghost.getGraphics().scale.set(self.parent.ghost.sizeMultiplier); self.parent.ghost.x = 2048 / 2; } self.answerButtons.forEach(function (button) { button.destroy(); }); self.answerButtons = []; self.solve(ghost); }); answerButton.x = 2048 / 2 - 700; answerButton.y = positions[index]; self.answerButtons.push(answerButton); LK.gui.topCenter.addChild(answerButton); })(i); } }; self.update = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); self.solvePuzzle = function (ghost) {}; self.ghost = self.addChild(new Ghost()); self.ghost.x = 2048 / 2; self.ghost.y = 2732 / 4 + 500; hero = self.addChild(new Hero()); this.puzzle = this.addChild(new Puzzle()); this.puzzle.x = 2048 / 2; this.puzzle.y = 2732 / 2 - this.puzzle.height / 2; var score = 0; self.score = score; var scoreTxt = new Text2(self.score.toString(), { size: 127.5, fill: "#000000", font: 'Times New Roman' }); LK.on('tick', function () { scoreTxt.setText(score.toString()); }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; var score = 0; var hero = this.addChild(new Hero()); hero.x = 2048 / 2; hero.y = 2732 / 2; LK.on('tick', function () { hero.update(); self.ghost.update(); self.puzzle.update(); if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -258,9 +258,8 @@
LK.on('tick', function () {
hero.update();
self.ghost.update();
self.puzzle.update();
- this.puzzle.solve(this.ghost);
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
Book pages, blank, open book, no text, front facing Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Scrap of paper, horizontal, blank, torn edge Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Rfireball blue magic Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Ghost girl, scary, horror movie, full body, Japanese ghost, Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Spooky abandoned house interior Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White rectangle, game UI, blank, flat 2D Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Horror game UI sign, "SANITY BREAK" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Fear icon, horror game Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.