User prompt
When player answers correctly, update question and answers to new ones
User prompt
Spread out answer buttons vertically by 50 pixels
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'this.ghost.update')' in this line: 'this.ghost.update();' Line Number: 192
User prompt
Fix Bug: 'ReferenceError: Can't find variable: ghost' in this line: 'ghost.update();' Line Number: 192
User prompt
Fix Bug: 'ReferenceError: Can't find variable: ghost' in this line: 'ghost.update();' Line Number: 192
User prompt
Put 10 pixels of space vertically between each question button
User prompt
Fix Bug: 'ReferenceError: Can't find variable: ghost' in this line: 'ghost.sizeMultiplier = 1;' Line Number: 115
User prompt
Fix Bug: 'ReferenceError: Can't find variable: ghost' in this line: 'ghost.sizeMultiplier = 1;' Line Number: 112
User prompt
When player answers correctly, flash the screen white and the ghost is knocked back to starting position
User prompt
Move the answers and answer buttons 100 pixels right
User prompt
Fix Bug: 'ReferenceError: Can't find variable: ghost' in this line: 'ghost.sizeMultiplier = Math.max(1, ghost.sizeMultiplier - 0.5);' Line Number: 111
User prompt
Increase space between answers by 2%
User prompt
Increase answer text size by 90%
User prompt
Move answers up 400 pixels, ensure text is on top later above graphic
User prompt
Move answers 400 pixels left
User prompt
Fix Bug: 'TypeError: callback is not a function. (In 'callback(index)', 'callback' is undefined)' in this line: 'callback(index);' Line Number: 58
User prompt
Fix Bug: 'TypeError: self.parent.checkAnswer is not a function. (In 'self.parent.checkAnswer(index)', 'self.parent.checkAnswer' is undefined)' in this line: 'if (self.parent.checkAnswer(index)) {' Line Number: 58
User prompt
Move answers left 400 pixels
User prompt
Separate answers into a vertical row
User prompt
All 3 answers must be visible on screen
User prompt
Fix Bug: 'ReferenceError: Can't find variable: index' in this line: 'if (self.parent.checkAnswer(index)) {' Line Number: 57
User prompt
Move questions up 250 pixels
User prompt
Move answers and answer button left 500 pixels
User prompt
Reduce font by 15%
User prompt
Move questions left 200 pixels
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.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.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 + 10)); } 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 / 4; } self.answerButtons.forEach(function (button) { button.destroy(); }); self.answerButtons = []; }); answerButton.x = 2048 / 2 - 700; answerButton.y = positions[index]; self.answerButtons.push(answerButton); LK.gui.topCenter.addChild(answerButton); })(i); } self.puzzleGraphics = self.createAsset('puzzle', 'Puzzle element', .5, .5); 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)]; var questionText = new Text2(this.chosenQuestion.question, { size: 85, fill: '#ffffff' }); questionText.anchor.set(0.5, 0); questionText.x = 2048 / 2; questionText.y = 2732 / 4; self.addChild(questionText); var positions = [2048 / 6, 2048 / 2, 2048 * 5 / 6]; for (var i = 0; i < this.chosenQuestion.answers.length; i++) { (function (index) { var answerButton = new AnswerButton(this.chosenQuestion.answers[index], index, function (buttonIndex) { if (index === self.chosenQuestion.correct) { self.parent.ghost.sizeMultiplier = Math.max(1, self.parent.ghost.sizeMultiplier - 0.5); self.parent.ghost.getGraphics().scale.set(self.parent.ghost.sizeMultiplier); } self.solve(ghost); }); answerButton.x = positions[index]; answerButton.y = 2732 / 2; self.answerButtons.push(answerButton); self.addChild(answerButton); })(i); } }; self.update = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('background', 'Game background', 0, 0); background.width = 2048; background.height = 2732; self.addChildAt(background, 0); this.ghost = self.addChild(new Ghost()); this.ghost.x = 2048 / 2; this.ghost.y = 2732 / 4; hero = self.addChild(new Hero()); var puzzles = []; var puzzle = self.addChild(new Puzzle()); puzzle.x = 2048 / 2; puzzle.y = 2732 - puzzle.height / 2 + 800; puzzles.push(puzzle); var scoreTxt = new Text2('0', { size: 127.5, fill: "#000000", font: 'Times New Roman' }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; var hero; LK.on('tick', function () { hero.update(); self.ghost.update(); puzzles.forEach(function (puzzle) { puzzle.update(); if (puzzle.isSolved) { puzzle.solve(ghost); } }); if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -188,9 +188,9 @@
var isGameOver = false;
var hero;
LK.on('tick', function () {
hero.update();
- this.ghost.update();
+ self.ghost.update();
puzzles.forEach(function (puzzle) {
puzzle.update();
if (puzzle.isSolved) {
puzzle.solve(ghost);
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.