Code edit (22 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: letter is not defined' in or related to this line: 'var blackboardText = new Text2(letter, {' Line Number: 61
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
in function resetgamefornextlevel, make a few seconds long pause before displaylettersniline is called, and show a message to the player: next level
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: Lk is not defined' in or related to this line: 'Lk.getSound('correctWord').play();' Line Number: 114
Code edit (5 edits merged)
Please save this source code
User prompt
play the tap sound when a lettertile is tapped
Code edit (8 edits merged)
Please save this source code
User prompt
play the background music when the game starts, and let it repeat until gameover
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: submitButon is not defined' in or related to this line: 'submitButon.destroy();' Line Number: 293
Code edit (1 edits merged)
Please save this source code
Code edit (16 edits merged)
Please save this source code
User prompt
please implement function gameWon such that it displays a message 'Congratulations! You found all the worrd!' for a few seconds before calling KLshowGameOver.
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: letterTilesArr is not a function' in or related to this line: 'letterTilesArr(letterTile);' Line Number: 235
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'anchor')' in or related to this line: 'scoreTxt.anchor.set(0.5, 0);' Line Number: 132
Code edit (2 edits merged)
Please save this source code
User prompt
when a word is correct, remove it from the levels[currentLevel].words array
===================================================================
--- original.js
+++ change.js
@@ -9,14 +9,14 @@
});
self.count = 0;
self.down = function (x, y, obj) {
self.update = function () {
- if (self.y > 1550) {
+ if (self.y > 1580) {
self.y -= 10;
}
self.count++;
if (self.count > 90) {
- self.y = 1700;
+ self.y = 1670;
self.count = 0;
self.update = null;
}
};
@@ -95,9 +95,9 @@
// Remove the correct word from the levels[currentLevel].words array
levels[currentLevel].words = levels[currentLevel].words.filter(function (word) {
return word !== currentWord;
});
- console.log('correct');
+ //console.log('correct');
var scoreIncrement = currentWord.length;
LK.setScore(LK.getScore() + scoreIncrement);
scoreTxt.setText('Score: ' + LK.getScore());
// Create star explosion effect
@@ -111,14 +111,14 @@
child.clickable = true;
}
});
currentWord = "";
- console.log('length: ', levels[currentLevel].words.length);
+ //console.log('length: ', levels[currentLevel].words.length);
if (levels[currentLevel].words.length == 0) {
advanceToNextLevel();
}
} else {
- console.log('incorrect');
+ //console.log('incorrect');
// Destroy the letters on the blackboard
clearBlackBoard();
// Reset the letter tiles
game.children.forEach(function (child) {
@@ -213,10 +213,10 @@
rabbit.x = 250;
rabbit.y = 1700;
game.addChild(rabbit);
var cat = new Cat();
-cat.x = 2000;
-cat.y = 1700;
+cat.x = 1800;
+cat.y = 1670;
game.addChild(cat);
var tables = LK.getAsset('tables', {
anchorX: 0.5,
anchorY: 0.5,
@@ -230,34 +230,8 @@
game.addChild(teacher);
// Function to reset the game state for the new level
function resetGameStateForNewLevel() {
// Logic to reset the game state for the new level
- // For example, clear the board, reset the score, etc.
- //LK.setScore(0);
- //scoreTxt.setText(LK.getScore());
- // Reset the letter tiles
- /*
- game.children.forEach(function (child) {
- if (child instanceof LetterTile) {
- child.alpha = 1;
- child.down = function (x, y, obj) {
- writeLetterOnBlackboard(self.letter);
- currentWord += self.letter;
- self.alpha = 0.5;
- self.clickable = false;
- };
- }
- });*/
- game.children.forEach(function (child) {
- if (child instanceof LetterTile) {
- child.destroy();
- }
- });
- game.children.forEach(function (child) {
- if (child instanceof LetterTile) {
- child.destroy();
- }
- });
letterTilesArr.forEach(function (child) {
child.destroy();
});
wholeBlackBoardArr.forEach(function (child) {
@@ -293,10 +267,27 @@
blackboardOffsetY = 0;
resetGameStateForNewLevel();
} else {
console.log("All levels completed!");
+ gameWon();
}
}
+function gameWon() {
+ var congratsText = new Text2('Congratulations! You found all the words!', {
+ size: 100,
+ fill: "#ffffff",
+ stroke: "#000000",
+ strokeThickness: 10
+ });
+ congratsText.anchor.set(0.5, 0.5);
+ congratsText.x = 2048 / 2;
+ congratsText.y = 2732 / 2;
+ game.addChild(congratsText);
+ LK.setTimeout(function () {
+ congratsText.destroy();
+ LK.showGameOver();
+ }, 3000); // Display the message for 3 seconds
+}
// Define levels with different sets of letters and acceptable words
var levels3 = [{
letters: ['N', 'W', 'O'],
words: ['NOW', 'WON', 'OWN']
A smooth, clean, blank and empty scrabble tile for a game.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A clean, warm and welcoming classroom in a school, facing the blackboard.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A small golden star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.