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
Code edit (1 edits merged)
Please save this source code
Code edit (15 edits merged)
Please save this source code
User prompt
make a small star explosion on the blackboard when a word is correct
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: blackBoardText is not defined' in or related to this line: 'blackBoardArr.push(blackBoardText);' Line Number: 129
Code edit (1 edits merged)
Please save this source code
User prompt
when a submitted word is incorrect, destroy the letters on the blackboard and reset the lettertiles to alpha 1 and being clickable
Code edit (17 edits merged)
Please save this source code
User prompt
when a submitted word is correct, add 1 point of score for each letter in the word and update a scorelabel with the new score
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'letters')' in or related to this line: 'return levels[currentLevel].letters;' Line Number: 214
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: levels is not defined' in or related to this line: 'return levels[currentLevel];' Line Number: 240
Code edit (5 edits merged)
Please save this source code
User prompt
please populate the levels array with 10 sets of 3 letters and the words these can spell out
User prompt
each level should have it's letters, but also a set of acceptable words. please make a structure for that.
Code edit (8 edits merged)
Please save this source code
User prompt
once the first letter on each level is clicked, a submit button shoud appear below the leters
===================================================================
--- original.js
+++ change.js
@@ -112,10 +112,12 @@
blackBoardArr.forEach(function (child) {
child.destroy();
});
blackBoardArr = [];
+ letterTilesArr = [];
}
var blackBoardArr = [];
+var wholeBlackBoardArr = [];
var currentWord = "";
var levelTxt = new Text2('Level 1', {
size: 60,
fill: "#ADD8E6",
@@ -145,8 +147,9 @@
blackboardText.x = 400 + blackboardOffsetX;
blackboardText.y = 400 + blackboardOffsetY;
game.addChild(blackboardText);
blackBoardArr.push(blackboardText);
+ wholeBlackBoardArr.push(blackboardText);
blackboardOffsetX += 110; // Adjust the offset value as needed
// Check if this is the first letter clicked
if (blackboardOffsetX === 110) {
var submitButton = new SubmitButton();
@@ -190,13 +193,26 @@
if (child instanceof LetterTile) {
child.destroy();
}
});
+ game.children.forEach(function (child) {
+ if (child instanceof LetterTile) {
+ child.destroy();
+ }
+ });
+ letterTilesArr.forEach(function (child) {
+ child.destroy();
+ });
+ letterTilesArr = [];
+ wholeBlackBoardArr.forEach(function (child) {
+ child.destroy();
+ });
blackboardOffsetX = 0;
blackboardOffsetXY = 0;
currentWord = "";
displayLettersInLine();
}
+var letterTilesArr = [];
// Function to display letters in a line centered at height 2000
function displayLettersInLine() {
var startX = 2048 / 2 - letters.length * 220 / 2 + 100;
var y = 2000;
@@ -206,16 +222,21 @@
letterTile.setLetter(letters[i]);
letterTile.x = x;
letterTile.y = y;
game.addChild(letterTile);
+ letterTilesArr.push(letterTile);
}
}
// Function to advance to the next level
function advanceToNextLevel() {
if (currentLevel < levels.length - 1) {
currentLevel++;
letters = getLettersForCurrentLevel();
+ levelTxt.setText('Level ' + (currentLevel + 1));
+ clearBlackBoard();
+ blackboardOffsetY = 0;
resetGameStateForNewLevel();
+ letterTilesArr = [];
} else {
console.log("All levels completed!");
}
}
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.