Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (wordsMainList.length == 0) {' Line Number: 723
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (wordsMainList.length == 0) {' Line Number: 723
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'if (wordsMainList.length == 0) {' Line Number: 722
Code edit (11 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'var randomIndex = Math.floor(Math.random() * wordsMainList.length);' Line Number: 723
User prompt
Please fix the bug: 'ReferenceError: i is not defined' in or related to this line: 'initGameThema(mainListsList[i], backGroundsList[i]);' Line Number: 459
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading '0')' in or related to this line: 'if (mainGrid.cells[i][j].isClicked) {' Line Number: 909
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: word is not defined' in or related to this line: 'scoreTest = "firtWord: " + word;' Line Number: 922
Code edit (1 edits merged)
Please save this source code
Code edit (15 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: wordGgrid is not defined' in or related to this line: 'var letter = clueWord[wordGgrid.gridColumns];' Line Number: 633
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: wordOfGrid is undefined' in or related to this line: 'if (notEnoughtMoneyForDrop || clueWord == '' && !wordGrid.isEmpty() || clueWord.length < wordOfGrid.length) {' Line Number: 903
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: wordGrid.words[0] is undefined' in or related to this line: 'return true;' Line Number: 267
Code edit (1 edits merged)
Please save this source code
Code edit (20 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: clueButtonLetter is not defined' in or related to this line: 'scrollCostCoins(clueButtonLetter.x, clueButtonLetter.y, 1, 10);' Line Number: 549
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -322,8 +322,9 @@
var clueWord = '';
var costForLetter = 10; //Coût pour l'indice de la première lettre
var costForWord = 5; //Coût pour l'indice du mot
var costForDrop = 10; //Coût pour l'indice drop letter
+var rewardForLetter = 10;
var rewardForEmpty = 50;
/****
* Game zones and backgrounds
****/
@@ -446,33 +447,28 @@
//On vide la grille des lettres formant le mot final apres x secondes
LK.setTimeout(function () {
var tableauFrom = wordGrid.cellsPositions();
for (var i = 0; i < tableauFrom.length; i++) {
- var image = createImageToSrollRescale('RewardsCoin', tableauFrom[i].x, tableauFrom[i].y, {
- xToReach: game.width / 2,
- yToReach: MainZone.y - scoreText.height / 2,
- nbTicksLeft: Math.floor(Math.random() * 30) + 40,
- valueToAddToScore: 10,
- soundOnEnd: 'SoundRewardCoin',
- isDestroyedOnEnd: true,
- animate: true
- });
- imagesToScrollRescale.push(image);
+ var ticks = Math.floor(Math.random() * 30) + 40;
+ scrollCoins(1, 'RewardsCoin', tableauFrom[i].x, tableauFrom[i].y, ticks, rewardForLetter, 'SoundRewardCoin', game.width / 2, MainZone.y - scoreText.height / 2);
}
+ if (isWordInMainList) {
+ //Si le mot est dans la liste principale, on compense les lettres utilisées avec récompense
+ for (var i = 0; i < wordGrid.gridColumns; i++) {
+ mainGrid.setLetter(wordGrid.cells[0][i].columnFrom, wordGrid.cells[0][i].lineFrom, wordGrid.cells[0][i].letter);
+ var xAbsCell = wordGrid.cells[0][i].columnFrom * wordGrid.cells[0][i].cellSize + mainGrid.x + wordGrid.cells[0][i].cellSize / 2;
+ var yAbsCell = wordGrid.cells[0][i].lineFrom * wordGrid.cells[0][i].cellSize + mainGrid.y + wordGrid.cells[0][i].cellSize / 2;
+ LK.setTimeout(function () {
+ scrollCoins(1, 'RewardsCoin', xAbsCell, yAbsCell, 30, rewardForLetter, 'SoundRewardCoin', game.width / 2, MainZone.y - scoreText.height / 2);
+ }, 1000);
+ }
+ isWordInMainList = false;
+ }
wordGrid.resetGrid();
initWordGrid();
}, 1000);
if (mainGrid.isEmpty()) {
- var image = createImageToSrollRescale('RewardsCoin', mainGrid.x + mainGrid.width / 2, mainGrid.y + mainGrid.height / 2, {
- xToReach: game.width / 2,
- yToReach: MainZone.y - scoreText.height / 2,
- nbTicksLeft: 30,
- valueToAddToScore: rewardForEmpty,
- soundOnEnd: 'SoundEmptyGrid',
- isDestroyedOnEnd: true,
- animate: true
- });
- imagesToScrollRescale.push(image);
+ scrollCoins(1, 'RewardsCoin', mainGrid.x + mainGrid.width / 2, mainGrid.y + mainGrid.height / 2, 30, rewardForEmpty, 'SoundEmptyGrid', game.width / 2, MainZone.y - scoreText.height / 2);
isMGRefillrequired = true;
}
} else {
//Le mot n'est pas valide, on remet les lettres dans la grille principale
@@ -568,9 +564,10 @@
//On change la couleur des lettres d'un des mots au hasard de mainGrid.words
if (mainGrid.words.length >= 1) {
var randomIndex = Math.floor(Math.random() * mainGrid.words.length);
var word = mainGrid.words[randomIndex];
- mainGrid.colorWordCells(word, "#FF5500");
+ var randomColor = Math.floor(Math.random() * 16777215).toString(16); //On choisit une couleur au hasard parmi 16777215 couleurs
+ mainGrid.colorWordCells(word, "#" + randomColor);
LK.setTimeout(function () {
mainGrid.colorWordCells(word, "#000000");
scrollCostCoins(clueButtonWord.x, clueButtonWord.y, word.length, costForWord);
}, 3000);
@@ -614,14 +611,15 @@
}
} else if (!wordGrid.isEmpty() && clueWord != '') {
//On reconstitue le mot contenu dans wordGrid
var word = wordGrid.firstWord();
- if (word == clueWord.substring(0, wordGrid.gridColumns)) {
- var letter = clueWord[wordGrid.gridColumns];
+ var letterRank = wordGrid.gridColumns;
+ if (word == clueWord.substring(0, letterRank)) {
+ var letter = clueWord[letterRank];
//On descend la suite du mot
mainGrid.findNclickCell(letter);
if (word != clueWord) {
- scrollCostCoins(clueButtonDrop.x, clueButtonDrop.y, 1, costForDrop);
+ scrollCostCoins(clueButtonDrop.x, clueButtonDrop.y, 1, letterRank * costForDrop);
} else if (word == clueWord && word != '') {
clueWord = '';
}
} else {
@@ -717,11 +715,12 @@
wordGrid.addWord(word); //Archive les mots trouves
mainGrid.removeWord(word); //Retire le mot de la grille principale
isWordValid = true;
} else if (wordsMainList.includes(word)) {
- scoreTest = "word in main:" + word;
+ scoreTest = "Word in main list : " + word;
isWordValid = true;
isWordInMainList = true;
+ wordsMainList.splice(wordsMainList.indexOf(word), 1); //Retire le mot de la liste principale
} else {
isWordValid = false;
}
wordGrid.colorAllCells(isWordValid ? "#00FF00" : "#FF0000");
@@ -761,23 +760,8 @@
var image = createImageToSrollRescale(asset, tableauFrom[i].x, tableauFrom[i].y, options);
imagesToScrollRescale.push(image);
}
} //fin createImages
-//Fonction scrollRewardCoins : permet de faire défiler des pièces de monnaie
-function scrollRewardCoins(nbCoins, valueToAddToScore, xFrom, yFrom) {
- for (var i = 0; i < nbCoins; i++) {
- var image = createImageToSrollRescale('RewardsCoin', xFrom, yFrom, {
- xToReach: game.width / 2,
- yToReach: MainZone.y - scoreText.height / 2,
- nbTicksLeft: Math.floor(Math.random() * 30) + 40,
- valueToAddToScore: valueToAddToScore,
- soundOnEnd: 'SoundRewardCoin',
- isDestroyedOnEnd: true,
- animate: true
- });
- imagesToScrollRescale.push(image);
- }
-} //fin scrollRewardCoins
//Fonction scrollCostCoins : permet de faire défiler des pièces de monnaie
function scrollCostCoins(xTo, yTo, nbCoins, valueToTakeFromScore) {
for (var i = 0; i < nbCoins; i++) {
var image = createImageToSrollRescale('CostCoin', game.width / 2, MainZone.y - scoreText.height / 2, {
@@ -791,8 +775,23 @@
});
imagesToScrollRescale.push(image);
}
} //fin scrollCostCoins
+//Fonction scrollCoins : permet de faire défiler des pièces de monnaie
+function scrollCoins(nbCoins, asset, xFrom, yFrom, ticksLeft, valueToAddToScore, soundOnEnd, xTo, yTo) {
+ for (var i = 0; i < nbCoins; i++) {
+ var image = createImageToSrollRescale(asset, xFrom, yFrom, {
+ xToReach: xTo,
+ yToReach: yTo,
+ nbTicksLeft: ticksLeft,
+ valueToAddToScore: valueToAddToScore,
+ soundOnEnd: soundOnEnd,
+ isDestroyedOnEnd: true,
+ animate: true
+ });
+ imagesToScrollRescale.push(image);
+ }
+} //fin scrollCoins
//Fonction scrollRescaleImages permettant de faire défiler et redimensionner des images
function scrollRescaleImages() {
for (var i = 0; i < imagesToScrollRescale.length; i++) {
if (imagesToScrollRescale[i].animate) {
@@ -851,8 +850,9 @@
* Main loop
****/
game.update = function () {
//Mise à jour score
+ //scoreTest = "Words left: " + wordsMainList.length;
updateScoreTest(scoreTest);
if (isScoreUpdatable) {
updateScore(score);
isScoreUpdatable = false;
An empty cell.
Drapeau national des USA en fond d'un patchwork des États américains.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Une jeton de scrabble sans lettre.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Un bouton arrondi suggérant une validation mais sans texte écrit dessus.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round button with a cyan interrogation mark.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A round cyan button with a yellow lamp bulb.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Planetes.
Remove the white square and the red lines.
A patchwork of european countries with the european unio flag in back ground.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A yellow coin wher we can see '+10' written on it.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A red coin wher we can see '-10' written on it... Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Patchwork of heads of plenty animals.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
The periodic table of the elements.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Patchwork de mots sur un fond cyan.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Patchwork of scene extracted from video games.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
It is written "COOL QUIZZ".
A cyan circle button with a home silhouette in the center. The button means "go back to start window". Avoid white color.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.