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
User prompt
once a letter is clicked, it should become 0.5 alpha and unclickable
User prompt
please adda black outline to backboardtext
Code edit (1 edits merged)
Please save this source code
User prompt
each added letter on blackboard should be offeset x-wise
User prompt
when player clicks a letter, it is written on the blackboard
Code edit (7 edits merged)
Please save this source code
User prompt
make a teacher class and graphics asset, and place her immediately above the background
Code edit (5 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -49,8 +49,28 @@
LK.setScore(LK.getScore() + scoreIncrement);
scoreTxt.setText(LK.getScore());
} else {
console.log('incorrect');
+ // Destroy the letters on the blackboard
+ game.children.forEach(function (child) {
+ if (child instanceof Text2 && child !== scoreTxt) {
+ child.destroy();
+ }
+ });
+ // 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.down = null; // Make it unclickable
+ };
+ }
+ });
+ blackboardOffsetX = 0;
+ currentWord = "";
}
};
return self;
});
@@ -107,21 +127,33 @@
anchorY: 0.5,
x: 2048 / 2 - 50,
y: 2732 / 2 - 200
});
-game.init = function () {
- game.addChild(background);
- var teacher = new Teacher();
- teacher.x = 2048 / 2 + 380;
- teacher.y = 2732 / 2 - 250;
- game.addChild(teacher);
-};
+var teacher = new Teacher();
+game.addChild(background);
+teacher.x = 2048 / 2 + 380;
+teacher.y = 2732 / 2 - 250;
+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.down = null; // Make it unclickable
+ };
+ }
+ });
+ blackboardOffsetX = 0;
+ currentWord = "";
displayLettersInLine();
}
// Function to display letters in a line centered at height 2000
function displayLettersInLine() {
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.