Code edit (4 edits merged)
Please save this source code
User prompt
when player clicks on streaktext, show a litttle window with this message: "Your streak increases with each successive correct guess, but is reset to 0 on a wrong guess. Extend your streak for better score multipliers." The window should also have a close button.
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: star is not defined' in or related to this line: 'star.alpha -= 1 / lifetime;' Line Number: 590
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: streakText is not defined' in or related to this line: 'streakText.setText("Streak: " + streak + streakBonus);' Line Number: 270
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,15 @@
/****
* Classes
****/
+var BlackboardPlaceholder = Container.expand(function () {
+ var self = Container.call(this);
+ var bpGraphics = self.attachAsset('blackboardPlaceholder', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ return self;
+});
var Cat = Container.expand(function () {
var self = Container.call(this);
var catGraphics = self.attachAsset('cat', {
anchorX: 0.5,
@@ -24,8 +32,25 @@
};
};
return self;
});
+var LetterOnBlackboard = Container.expand(function () {
+ var self = Container.call(this);
+ self.letter = '';
+ var blackboardText = new Text2(self.letter, {
+ size: 120,
+ fill: "#ffffff",
+ stroke: "#000000",
+ strokeThickness: 10
+ });
+ blackboardText.anchor.set(0.5, 0.5);
+ self.addChild(blackboardText);
+ self.setLetter = function (letter) {
+ self.letter = letter;
+ blackboardText.setText(letter);
+ };
+ return self;
+});
//<Assets used in the game will automatically appear here>
// Class for Letter Tiles
var LetterTile = Container.expand(function () {
var self = Container.call(this);
@@ -110,8 +135,9 @@
levels[currentLevel].words = levels[currentLevel].words.filter(function (word) {
return word !== currentWord;
});
//console.log('correct');
+ streak += 1;
var scoreIncrement = currentWord.length;
LK.setScore(LK.getScore() + scoreIncrement);
scoreTxt.setText('Score: ' + LK.getScore());
// Create star explosion effect
@@ -135,10 +161,11 @@
}
} else {
//console.log('incorrect');
LK.getSound('wrongWord').play();
+ streak = 0;
// Destroy the letters on the blackboard
- clearBlackBoard();
+ clearBlackBoard(false);
// Reset the letter tiles
game.children.forEach(function (child) {
if (child instanceof LetterTile) {
child.alpha = 1;
@@ -172,13 +199,21 @@
/****
* Game Code
****/
function clearBlackBoard() {
+ var placeholdersToo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
blackBoardArr.forEach(function (child) {
child.destroy();
});
blackBoardArr = [];
+ if (placeholdersToo) {
+ placeholderArr.forEach(function (child) {
+ child.destroy();
+ });
+ placeholderArr = [];
+ }
}
+var streak = 0;
var blackBoardArr = [];
var wholeBlackBoardArr = [];
var currentWord = "";
var levelTxt = new Text2('Level 1', {
@@ -201,17 +236,20 @@
LK.gui.top.addChild(scoreTxt);
var blackboardOffsetX = 0;
var blackboardOffsetY = 0;
function writeLetterOnBlackboard(letter) {
+ /*
var blackboardText = new Text2(letter, {
size: 120,
fill: "#ffffff",
stroke: "#000000",
strokeThickness: 10
});
- blackboardText.anchor.set(0.5, 0.5);
+ blackboardText.anchor.set(0.5, 0.5);*/
+ var blackboardText = new LetterOnBlackboard();
blackboardText.x = 400 + blackboardOffsetX;
blackboardText.y = 400 + blackboardOffsetY;
+ blackboardText.setLetter(letter);
game.addChild(blackboardText);
blackBoardArr.push(blackboardText);
wholeBlackBoardArr.push(blackboardText);
blackboardOffsetX += 80; // Adjust the offset value as needed
@@ -266,9 +304,9 @@
blackboardOffsetXY = 0;
currentWord = "";
var nextLevelBackground = new NextLevelBackground();
nextLevelBackground.x = 0;
- nextLevelBackground.y = 1550;
+ nextLevelBackground.y = 1500;
game.addChild(nextLevelBackground);
var nextLevelText = new Text2('Level ' + (currentLevel + 1), {
size: 200,
fill: "#ffffff",
@@ -306,9 +344,33 @@
letterTile.y = y;
game.addChild(letterTile);
letterTilesArr.push(letterTile);
}
+ displayBlackboardPlaceholders();
}
+var placeholderArr = [];
+function displayBlackboardPlaceholders() {
+ console.log('ok');
+ var words = levels[currentLevel].words;
+ var offsetX = 0;
+ var offsetY = 60;
+ for (var i = 0; i < words.length; i++) {
+ console.log('ok i');
+ for (var j = 0; j < words[i].length; j++) {
+ console.log('ok j');
+ var p = new BlackboardPlaceholder();
+ p.x = 400 + offsetX;
+ p.y = 400 + offsetY;
+ game.addChild(p);
+ placeholderArr.push(p);
+ offsetX += 80;
+ if (j == words[i].length - 1) {
+ offsetX = 0;
+ offsetY += 118;
+ }
+ }
+ }
+}
// Function to advance to the next level
function advanceToNextLevel() {
if (currentLevel < levels.length - 1) {
currentLevel++;
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.