User prompt
add level selection menu this menu can be accessed from the top right
User prompt
Add a level selection menu and click on the button on the top right to open this menu.
User prompt
Add a section selection menu and click on the button on the top right to open this menu.
User prompt
Add a section selection menu and click on the button on the top right to open this menu.
User prompt
MAKE İT CORRECT!!!!
User prompt
levels still not coming
User prompt
The levels do not change when we get them right, fix this and move on to the next level when we get every question right
User prompt
The levels do not change when we get them right, fix this and move on to the next level when we get every question right
User prompt
fix the levels, the game must have 128 levels
User prompt
This time there are no levels, there should be exactly 128 levels and each level should have different troll puzzles, the background should be white and make contrast, make the blacks white and the whites black
User prompt
if we lose start from beginning
User prompt
There are some problems, fix them
User prompt
Make me a brain test style game that requires a lot of logic and includes trolls with levels.
User prompt
Please fix the bug: 'input is not defined' in or related to this line: 'n = input();' Line Number: 11
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: tween is not defined' in or related to this line: 'tween(card, {' Line Number: 277 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: tween is not defined' in or related to this line: 'tween(card, {' Line Number: 277 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.now is not a function' in or related to this line: 'if (requests.length < maxRequestsOnScreen && LK.now() - lastRequestSpawn > requestSpawnInterval) {' Line Number: 392
Code edit (1 edits merged)
Please save this source code
User prompt
AI Assistant Simulator
User prompt
make me a Ai asisstant
User prompt
Please continue polishing my design document.
Initial prompt
make me a Ai asisstant
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xffffff }); /**** * Game Code ****/ // Ava (FRVR.Ava.Combo[POGAAS].v1.0): Brain Test style game with troll logic and levels // --- GLOBAL STATE --- var currentLevel = 0; var levels = []; var levelUI = null; var messageText = null; var nextButton = null; var trollTries = 0; // --- LEVEL DATA --- // Each level is an object: { setup: function, check: function, hint: string } levels = []; for (var i = 0; i < 128; i++) { (function (levelNum) { // Each level is a unique troll puzzle if (levelNum === 0) { // Level 1: "Which is the biggest?" (Troll: the question text is the biggest) levels.push({ setup: function setup() { clearLevel(); var sizes = [200, 300, 150]; var colors = [0xff0000, 0x00ff00, 0x0000ff]; var positions = [600, 1000, 1400]; for (var i = 0; i < 3; i++) { var c = LK.getAsset('circle' + i, { width: sizes[i], height: sizes[i], color: colors[i], shape: 'ellipse', anchorX: 0.5, anchorY: 0.5 }); c.x = positions[i]; c.y = 1200; c.interactive = true; c.down = function () { showMessage("Nope! Try again..."); trollTries++; }; game.addChild(c); } var q = new Text2("Which is the biggest?", { size: 180, fill: "#000" }); q.anchor.set(0.5, 0.5); q.x = 1024; q.y = 500; q.interactive = true; q.down = function () { showMessage("Correct! The question is the biggest!"); showNextButton(); }; game.addChild(q); levelUI = [q]; }, check: function check() {}, hint: "Look carefully at the question itself!" }); } else if (levelNum === 1) { // Level 2: "Find the hidden button" (Troll: invisible button) levels.push({ setup: function setup() { clearLevel(); var t = new Text2("Find the hidden button!", { size: 140, fill: "#000" }); t.anchor.set(0.5, 0.5); t.x = 1024; t.y = 400; game.addChild(t); var btn = LK.getAsset('hiddenBtn', { width: 300, height: 150, color: 0xffffff, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); btn.x = 1024; btn.y = 1200; btn.alpha = 0.01; btn.interactive = true; btn.down = function () { showMessage("You found it!"); showNextButton(); }; game.addChild(btn); levelUI = [t, btn]; }, check: function check() {}, hint: "Tap around the screen!" }); } else if (levelNum === 2) { // Level 3: "How many holes in this shirt?" (Troll: count all holes, front and back) levels.push({ setup: function setup() { clearLevel(); var t = new Text2("How many holes in this shirt?", { size: 120, fill: "#000" }); t.anchor.set(0.5, 0.5); t.x = 1024; t.y = 400; game.addChild(t); var shirt = LK.getAsset('shirt', { width: 600, height: 800, color: 0xdddddd, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); shirt.x = 1024; shirt.y = 1400; game.addChild(shirt); var answers = [2, 4, 6, 8]; for (var i = 0; i < answers.length; i++) { var a = new Text2(answers[i] + "", { size: 120, fill: "#fff" }); a.anchor.set(0.5, 0.5); a.x = 600 + i * 300; a.y = 2200; a.interactive = true; (function (val) { a.down = function () { if (val === 8) { showMessage("Correct! 8 holes (front and back)!"); showNextButton(); } else { showMessage("Nope! Count all holes, front and back!"); trollTries++; } }; })(answers[i]); game.addChild(a); } levelUI = [t, shirt]; }, check: function check() {}, hint: "Count all holes, including front and back!" }); } else if (levelNum === 3) { // Level 4: "Tap the green button" (Troll: all buttons are red except one tiny green pixel) levels.push({ setup: function setup() { clearLevel(); var t = new Text2("Tap the green button!", { size: 120, fill: "#000" }); t.anchor.set(0.5, 0.5); t.x = 1024; t.y = 400; game.addChild(t); for (var i = 0; i < 4; i++) { var r = LK.getAsset('greenBtn', { width: 300, height: 150, color: 0xff0000, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); r.x = 600 + i * 300; r.y = 1200; r.interactive = true; r.down = function () { showMessage("Nope! That's not green!"); trollTries++; }; game.addChild(r); } var g = LK.getAsset('greenBtn', { width: 40, height: 40, color: 0x00ff00, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); g.x = 1800; g.y = 2100; g.interactive = true; g.down = function () { showMessage("Correct! You found the green button!"); showNextButton(); }; game.addChild(g); levelUI = [t, g]; }, check: function check() {}, hint: "Look for a tiny green spot!" }); } else if (levelNum === 4) { // Level 5: "What is the answer to this question?" (Troll: answer is 'this question') levels.push({ setup: function setup() { clearLevel(); var t = new Text2("What is the answer to this question?", { size: 120, fill: "#000" }); t.anchor.set(0.5, 0.5); t.x = 1024; t.y = 400; game.addChild(t); var answers = ["42", "I don't know", "this question", "Nothing"]; for (var i = 0; i < answers.length; i++) { var a = new Text2(answers[i], { size: 100, fill: "#fff" }); a.anchor.set(0.5, 0.5); a.x = 600 + i * 300; a.y = 1200; a.interactive = true; (function (val) { a.down = function () { if (val === "this question") { showMessage("Correct! The answer is 'this question'!"); showNextButton(); } else { showMessage("Nope! Try again..."); trollTries++; } }; })(answers[i]); game.addChild(a); } levelUI = [t]; }, check: function check() {}, hint: "Read the question literally!" }); } else { // Generic troll levels for 5-128 levels.push({ setup: function setup() { clearLevel(); var t = new Text2("Troll Level " + (levelNum + 1), { size: 120, fill: levelNum % 2 === 0 ? "#000" : "#fff" }); t.anchor.set(0.5, 0.5); t.x = 1024; t.y = 400; game.addChild(t); // Add a fake button and a real answer in the text var fakeBtn = LK.getAsset('greenBtn', { width: 300, height: 150, color: levelNum % 2 === 0 ? 0xff0000 : 0x0000ff, shape: 'box', anchorX: 0.5, anchorY: 0.5 }); fakeBtn.x = 1024; fakeBtn.y = 1200; fakeBtn.interactive = true; fakeBtn.down = function () { showMessage("Nope! That's a troll!"); trollTries++; }; game.addChild(fakeBtn); // The real answer is to tap the level number in the title t.interactive = true; t.down = function () { showMessage("Correct! You out-trolled the troll!"); showNextButton(); }; levelUI = [t, fakeBtn]; }, check: function check() {}, hint: "Maybe the answer is in the title?" }); } })(i); } // --- LEVEL MANAGEMENT --- function clearLevel() { // Remove all children except GUI if (levelUI) { for (var i = 0; i < levelUI.length; i++) { if (levelUI[i] && levelUI[i].parent) levelUI[i].parent.removeChild(levelUI[i]); } } // Remove all children except GUI for (var i = game.children.length - 1; i >= 0; i--) { var c = game.children[i]; if (c && c !== messageText && c !== nextButton) { game.removeChild(c); } } if (messageText && messageText.parent) messageText.parent.removeChild(messageText); if (nextButton && nextButton.parent) nextButton.parent.removeChild(nextButton); messageText = null; nextButton = null; levelUI = []; } function showMessage(msg) { if (messageText && messageText.parent) messageText.parent.removeChild(messageText); messageText = new Text2(msg, { size: 100, fill: 0x0000FF }); messageText.anchor.set(0.5, 0.5); messageText.x = 1024; messageText.y = 300; LK.gui.top.addChild(messageText); // If the message indicates a loss, restart from the beginning after a short delay if (typeof msg === "string" && (msg.indexOf("Nope!") === 0 || msg.indexOf("Try again") !== -1 || msg.indexOf("Count all holes") !== -1)) { LK.setTimeout(function () { currentLevel = 0; trollTries = 0; if (messageText && messageText.parent) messageText.parent.removeChild(messageText); messageText = null; levels[currentLevel].setup(); }, 1200); } } function showNextButton() { if (nextButton && nextButton.parent) nextButton.parent.removeChild(nextButton); nextButton = new Text2("Next", { size: 100, fill: 0xFF00CC }); nextButton.anchor.set(0.5, 0.5); nextButton.x = 1024; nextButton.y = 600; nextButton.interactive = true; nextButton.down = function () { nextLevel(); }; LK.gui.top.addChild(nextButton); } function showHint() { if (levels[currentLevel] && levels[currentLevel].hint) { showMessage("Hint: " + levels[currentLevel].hint); } } function nextLevel() { currentLevel++; if (currentLevel >= levels.length) { // Game complete! clearLevel(); var winText = new Text2("You Win!\nTrolls defeated: " + trollTries, { size: 120, fill: 0xFF0000 }); winText.anchor.set(0.5, 0.5); winText.x = 1024; winText.y = 1200; game.addChild(winText); return; } levels[currentLevel].setup(); } // --- INITIALIZE FIRST LEVEL --- currentLevel = 0; trollTries = 0; levels[currentLevel].setup(); // --- OPTIONAL: Add a hint button --- var hintBtn = new Text2("Hint", { size: 80, fill: "#111" }); hintBtn.anchor.set(0.5, 0.5); hintBtn.x = 1900; hintBtn.y = 200; hintBtn.interactive = true; hintBtn.down = function () { showHint(); }; LK.gui.top.addChild(hintBtn);
===================================================================
--- original.js
+++ change.js
@@ -1,9 +1,9 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000
+ backgroundColor: 0xffffff
});
/****
* Game Code
@@ -17,235 +17,280 @@
var nextButton = null;
var trollTries = 0;
// --- LEVEL DATA ---
// Each level is an object: { setup: function, check: function, hint: string }
-levels = [
-// Level 1: "Which is the biggest?" (Troll: the question text is the biggest)
-{
- setup: function setup() {
- clearLevel();
- // Add three circles and the question text
- var sizes = [200, 300, 150];
- var colors = [0xff0000, 0x00ff00, 0x0000ff];
- var positions = [600, 1000, 1400];
- for (var i = 0; i < 3; i++) {
- var c = LK.getAsset('circle' + i, {
- width: sizes[i],
- height: sizes[i],
- color: colors[i],
- shape: 'ellipse',
- anchorX: 0.5,
- anchorY: 0.5
+levels = [];
+for (var i = 0; i < 128; i++) {
+ (function (levelNum) {
+ // Each level is a unique troll puzzle
+ if (levelNum === 0) {
+ // Level 1: "Which is the biggest?" (Troll: the question text is the biggest)
+ levels.push({
+ setup: function setup() {
+ clearLevel();
+ var sizes = [200, 300, 150];
+ var colors = [0xff0000, 0x00ff00, 0x0000ff];
+ var positions = [600, 1000, 1400];
+ for (var i = 0; i < 3; i++) {
+ var c = LK.getAsset('circle' + i, {
+ width: sizes[i],
+ height: sizes[i],
+ color: colors[i],
+ shape: 'ellipse',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ c.x = positions[i];
+ c.y = 1200;
+ c.interactive = true;
+ c.down = function () {
+ showMessage("Nope! Try again...");
+ trollTries++;
+ };
+ game.addChild(c);
+ }
+ var q = new Text2("Which is the biggest?", {
+ size: 180,
+ fill: "#000"
+ });
+ q.anchor.set(0.5, 0.5);
+ q.x = 1024;
+ q.y = 500;
+ q.interactive = true;
+ q.down = function () {
+ showMessage("Correct! The question is the biggest!");
+ showNextButton();
+ };
+ game.addChild(q);
+ levelUI = [q];
+ },
+ check: function check() {},
+ hint: "Look carefully at the question itself!"
});
- c.x = positions[i];
- c.y = 1200;
- c.interactive = true;
- c.down = function () {
- showMessage("Nope! Try again...");
- trollTries++;
- };
- game.addChild(c);
- }
- // The question text (actually the biggest)
- var q = new Text2("Which is the biggest?", {
- size: 180,
- fill: "#fff"
- });
- q.anchor.set(0.5, 0.5);
- q.x = 1024;
- q.y = 500;
- q.interactive = true;
- q.down = function () {
- showMessage("Correct! The question is the biggest!");
- showNextButton();
- };
- game.addChild(q);
- levelUI = [q];
- },
- check: function check() {},
- hint: "Look carefully at the question itself!"
-},
-// Level 2: "Find the hidden button" (Troll: invisible button)
-{
- setup: function setup() {
- clearLevel();
- var t = new Text2("Find the hidden button!", {
- size: 140,
- fill: "#fff"
- });
- t.anchor.set(0.5, 0.5);
- t.x = 1024;
- t.y = 400;
- game.addChild(t);
- // Invisible button
- var btn = LK.getAsset('hiddenBtn', {
- width: 300,
- height: 150,
- color: 0xffffff,
- shape: 'box',
- anchorX: 0.5,
- anchorY: 0.5
- });
- btn.x = 1024;
- btn.y = 1200;
- btn.alpha = 0.01;
- btn.interactive = true;
- btn.down = function () {
- showMessage("You found it!");
- showNextButton();
- };
- game.addChild(btn);
- levelUI = [t, btn];
- },
- check: function check() {},
- hint: "Tap around the screen!"
-},
-// Level 3: "How many holes in this shirt?" (Troll: count all holes, front and back)
-{
- setup: function setup() {
- clearLevel();
- var t = new Text2("How many holes in this shirt?", {
- size: 120,
- fill: "#fff"
- });
- t.anchor.set(0.5, 0.5);
- t.x = 1024;
- t.y = 400;
- game.addChild(t);
- // Draw shirt (rectangle with 2 sleeve holes, 1 neck, 1 bottom, 2 front holes, 2 back holes)
- var shirt = LK.getAsset('shirt', {
- width: 600,
- height: 800,
- color: 0xdddddd,
- shape: 'box',
- anchorX: 0.5,
- anchorY: 0.5
- });
- shirt.x = 1024;
- shirt.y = 1400;
- game.addChild(shirt);
- // Add answer buttons
- var answers = [2, 4, 6, 8];
- for (var i = 0; i < answers.length; i++) {
- var a = new Text2(answers[i] + "", {
- size: 120,
- fill: "#222"
- });
- a.anchor.set(0.5, 0.5);
- a.x = 600 + i * 300;
- a.y = 2200;
- a.interactive = true;
- (function (val) {
- a.down = function () {
- if (val === 8) {
- showMessage("Correct! 8 holes (front and back)!");
+ } else if (levelNum === 1) {
+ // Level 2: "Find the hidden button" (Troll: invisible button)
+ levels.push({
+ setup: function setup() {
+ clearLevel();
+ var t = new Text2("Find the hidden button!", {
+ size: 140,
+ fill: "#000"
+ });
+ t.anchor.set(0.5, 0.5);
+ t.x = 1024;
+ t.y = 400;
+ game.addChild(t);
+ var btn = LK.getAsset('hiddenBtn', {
+ width: 300,
+ height: 150,
+ color: 0xffffff,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ btn.x = 1024;
+ btn.y = 1200;
+ btn.alpha = 0.01;
+ btn.interactive = true;
+ btn.down = function () {
+ showMessage("You found it!");
showNextButton();
- } else {
- showMessage("Nope! Count all holes, front and back!");
- trollTries++;
+ };
+ game.addChild(btn);
+ levelUI = [t, btn];
+ },
+ check: function check() {},
+ hint: "Tap around the screen!"
+ });
+ } else if (levelNum === 2) {
+ // Level 3: "How many holes in this shirt?" (Troll: count all holes, front and back)
+ levels.push({
+ setup: function setup() {
+ clearLevel();
+ var t = new Text2("How many holes in this shirt?", {
+ size: 120,
+ fill: "#000"
+ });
+ t.anchor.set(0.5, 0.5);
+ t.x = 1024;
+ t.y = 400;
+ game.addChild(t);
+ var shirt = LK.getAsset('shirt', {
+ width: 600,
+ height: 800,
+ color: 0xdddddd,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ shirt.x = 1024;
+ shirt.y = 1400;
+ game.addChild(shirt);
+ var answers = [2, 4, 6, 8];
+ for (var i = 0; i < answers.length; i++) {
+ var a = new Text2(answers[i] + "", {
+ size: 120,
+ fill: "#fff"
+ });
+ a.anchor.set(0.5, 0.5);
+ a.x = 600 + i * 300;
+ a.y = 2200;
+ a.interactive = true;
+ (function (val) {
+ a.down = function () {
+ if (val === 8) {
+ showMessage("Correct! 8 holes (front and back)!");
+ showNextButton();
+ } else {
+ showMessage("Nope! Count all holes, front and back!");
+ trollTries++;
+ }
+ };
+ })(answers[i]);
+ game.addChild(a);
}
- };
- })(answers[i]);
- game.addChild(a);
- }
- levelUI = [t, shirt];
- },
- check: function check() {},
- hint: "Count all holes, including front and back!"
-},
-// Level 4: "Tap the green button" (Troll: all buttons are red except one tiny green pixel)
-{
- setup: function setup() {
- clearLevel();
- var t = new Text2("Tap the green button!", {
- size: 120,
- fill: "#fff"
- });
- t.anchor.set(0.5, 0.5);
- t.x = 1024;
- t.y = 400;
- game.addChild(t);
- // Red buttons
- for (var i = 0; i < 4; i++) {
- var r = LK.getAsset('greenBtn', {
- width: 300,
- height: 150,
- color: 0xff0000,
- shape: 'box',
- anchorX: 0.5,
- anchorY: 0.5
+ levelUI = [t, shirt];
+ },
+ check: function check() {},
+ hint: "Count all holes, including front and back!"
});
- r.x = 600 + i * 300;
- r.y = 1200;
- r.interactive = true;
- r.down = function () {
- showMessage("Nope! That's not green!");
- trollTries++;
- };
- game.addChild(r);
- }
- // Tiny green button
- var g = LK.getAsset('greenBtn', {
- width: 40,
- height: 40,
- color: 0x00ff00,
- shape: 'box',
- anchorX: 0.5,
- anchorY: 0.5
- });
- g.x = 1800;
- g.y = 2100;
- g.interactive = true;
- g.down = function () {
- showMessage("Correct! You found the green button!");
- showNextButton();
- };
- game.addChild(g);
- levelUI = [t, g];
- },
- check: function check() {},
- hint: "Look for a tiny green spot!"
-},
-// Level 5: "What is the answer to this question?" (Troll: answer is 'this question')
-{
- setup: function setup() {
- clearLevel();
- var t = new Text2("What is the answer to this question?", {
- size: 120,
- fill: "#fff"
- });
- t.anchor.set(0.5, 0.5);
- t.x = 1024;
- t.y = 400;
- game.addChild(t);
- var answers = ["42", "I don't know", "this question", "Nothing"];
- for (var i = 0; i < answers.length; i++) {
- var a = new Text2(answers[i], {
- size: 100,
- fill: "#222"
- });
- a.anchor.set(0.5, 0.5);
- a.x = 600 + i * 300;
- a.y = 1200;
- a.interactive = true;
- (function (val) {
- a.down = function () {
- if (val === "this question") {
- showMessage("Correct! The answer is 'this question'!");
+ } else if (levelNum === 3) {
+ // Level 4: "Tap the green button" (Troll: all buttons are red except one tiny green pixel)
+ levels.push({
+ setup: function setup() {
+ clearLevel();
+ var t = new Text2("Tap the green button!", {
+ size: 120,
+ fill: "#000"
+ });
+ t.anchor.set(0.5, 0.5);
+ t.x = 1024;
+ t.y = 400;
+ game.addChild(t);
+ for (var i = 0; i < 4; i++) {
+ var r = LK.getAsset('greenBtn', {
+ width: 300,
+ height: 150,
+ color: 0xff0000,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ r.x = 600 + i * 300;
+ r.y = 1200;
+ r.interactive = true;
+ r.down = function () {
+ showMessage("Nope! That's not green!");
+ trollTries++;
+ };
+ game.addChild(r);
+ }
+ var g = LK.getAsset('greenBtn', {
+ width: 40,
+ height: 40,
+ color: 0x00ff00,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ g.x = 1800;
+ g.y = 2100;
+ g.interactive = true;
+ g.down = function () {
+ showMessage("Correct! You found the green button!");
showNextButton();
- } else {
- showMessage("Nope! Try again...");
- trollTries++;
+ };
+ game.addChild(g);
+ levelUI = [t, g];
+ },
+ check: function check() {},
+ hint: "Look for a tiny green spot!"
+ });
+ } else if (levelNum === 4) {
+ // Level 5: "What is the answer to this question?" (Troll: answer is 'this question')
+ levels.push({
+ setup: function setup() {
+ clearLevel();
+ var t = new Text2("What is the answer to this question?", {
+ size: 120,
+ fill: "#000"
+ });
+ t.anchor.set(0.5, 0.5);
+ t.x = 1024;
+ t.y = 400;
+ game.addChild(t);
+ var answers = ["42", "I don't know", "this question", "Nothing"];
+ for (var i = 0; i < answers.length; i++) {
+ var a = new Text2(answers[i], {
+ size: 100,
+ fill: "#fff"
+ });
+ a.anchor.set(0.5, 0.5);
+ a.x = 600 + i * 300;
+ a.y = 1200;
+ a.interactive = true;
+ (function (val) {
+ a.down = function () {
+ if (val === "this question") {
+ showMessage("Correct! The answer is 'this question'!");
+ showNextButton();
+ } else {
+ showMessage("Nope! Try again...");
+ trollTries++;
+ }
+ };
+ })(answers[i]);
+ game.addChild(a);
}
- };
- })(answers[i]);
- game.addChild(a);
+ levelUI = [t];
+ },
+ check: function check() {},
+ hint: "Read the question literally!"
+ });
+ } else {
+ // Generic troll levels for 5-128
+ levels.push({
+ setup: function setup() {
+ clearLevel();
+ var t = new Text2("Troll Level " + (levelNum + 1), {
+ size: 120,
+ fill: levelNum % 2 === 0 ? "#000" : "#fff"
+ });
+ t.anchor.set(0.5, 0.5);
+ t.x = 1024;
+ t.y = 400;
+ game.addChild(t);
+ // Add a fake button and a real answer in the text
+ var fakeBtn = LK.getAsset('greenBtn', {
+ width: 300,
+ height: 150,
+ color: levelNum % 2 === 0 ? 0xff0000 : 0x0000ff,
+ shape: 'box',
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ fakeBtn.x = 1024;
+ fakeBtn.y = 1200;
+ fakeBtn.interactive = true;
+ fakeBtn.down = function () {
+ showMessage("Nope! That's a troll!");
+ trollTries++;
+ };
+ game.addChild(fakeBtn);
+ // The real answer is to tap the level number in the title
+ t.interactive = true;
+ t.down = function () {
+ showMessage("Correct! You out-trolled the troll!");
+ showNextButton();
+ };
+ levelUI = [t, fakeBtn];
+ },
+ check: function check() {},
+ hint: "Maybe the answer is in the title?"
+ });
}
- levelUI = [t];
- },
- check: function check() {},
- hint: "Read the question literally!"
-}];
+ })(i);
+}
// --- LEVEL MANAGEMENT ---
function clearLevel() {
// Remove all children except GUI
if (levelUI) {
@@ -269,9 +314,9 @@
function showMessage(msg) {
if (messageText && messageText.parent) messageText.parent.removeChild(messageText);
messageText = new Text2(msg, {
size: 100,
- fill: 0xFFCC00
+ fill: 0x0000FF
});
messageText.anchor.set(0.5, 0.5);
messageText.x = 1024;
messageText.y = 300;
@@ -290,9 +335,9 @@
function showNextButton() {
if (nextButton && nextButton.parent) nextButton.parent.removeChild(nextButton);
nextButton = new Text2("Next", {
size: 100,
- fill: 0x00CCFF
+ fill: 0xFF00CC
});
nextButton.anchor.set(0.5, 0.5);
nextButton.x = 1024;
nextButton.y = 600;
@@ -313,9 +358,9 @@
// Game complete!
clearLevel();
var winText = new Text2("You Win!\nTrolls defeated: " + trollTries, {
size: 120,
- fill: 0x00FF00
+ fill: 0xFF0000
});
winText.anchor.set(0.5, 0.5);
winText.x = 1024;
winText.y = 1200;
@@ -330,9 +375,9 @@
levels[currentLevel].setup();
// --- OPTIONAL: Add a hint button ---
var hintBtn = new Text2("Hint", {
size: 80,
- fill: "#888"
+ fill: "#111"
});
hintBtn.anchor.set(0.5, 0.5);
hintBtn.x = 1900;
hintBtn.y = 200;