Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: setClueButtonWord is not defined' in or related to this line: 'setClueButtonWord('ButtonClue1');' Line Number: 380
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: clueWord is undefined' in or related to this line: 'var letter = clueWord[clueLevel - 1];' Line Number: 487
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: 'Timeout.tick error: mainGrid.cells[line] is undefined' in or related to this line: 'if (mainGrid.cells[line][col]) {' Line Number: 453
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: word is undefined' in or related to this line: 'var wordShuffled = wordShuffled = word.split('').sort(function () {' Line Number: 495
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: pickAndShakeSingleWord is not defined' in or related to this line: 'var word = pickAndShakeSingleWord().word;' Line Number: 495
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: maingrid is not defined' in or related to this line: 'if (maingrid) {' Line Number: 547
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: clueButton is null' in or related to this line: 'clueButton = new Button('', {' Line Number: 433
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'var validateButton = new Button('', {' Line Number: 302
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'width')' in or related to this line: 'self.width = options.width || 200;' Line Number: 56
===================================================================
--- original.js
+++ change.js
@@ -33,8 +33,9 @@
anchorY: 0.5
});
self.cellSize = cellGraphics.width;
self.clickable = true; //Indique si la cellule est cliquable
+ self.wordFrom = ''; //Mot d'origine de la lettre
self.letter = letter;
self.policeSize = policeSize;
var text = new Text2(letter.toUpperCase(), {
size: self.policeSize,
@@ -189,15 +190,13 @@
}; //Fin de la fonction removeLetter
self.addWord = function (word) {
// Add a word in the list of words
self.words.push(word);
- scoreTest = "Nb mots : " + self.words.length + " wordsMainList : " + wordsMainList.length;
}; //Fin de la fonction addWord
self.removeWord = function (word) {
// Remove a word from the list of words
if (self.words.includes(word)) {
self.words.splice(self.words.indexOf(word), 1);
- scoreTest = "Nb mots : " + self.words.length + " wordsMainList : " + wordsMainList.length;
}
}; //Fin de la fonction removeWord
self.isFull = function () {
for (var i = 0; i < self.gridLines; i++) {
@@ -220,12 +219,13 @@
return true;
}; //Fin de la fonction isEmpty
self.colorWordCells = function (word, color) {
//Colorie les cellules du mot word en couleur color
- for (var i = 0; i < self.gridLines; i++) {
- for (var j = 0; j < self.gridColumns; j++) {
- if (word.includes(self.cells[i][j].letter)) {
- self.cells[i][j].setColorToLetter(color);
+ for (var j = 0; j < self.gridLines; j++) {
+ for (var k = 0; k < self.gridColumns; k++) {
+ if (word.includes(self.cells[j][k].letter)) {
+ self.cells[j][k].setColorToLetter(color);
+ word = word.replace(self.cells[j][k].letter, '');
}
}
}
}; //Fin de la fonction colorWordCells
@@ -403,8 +403,9 @@
wordGrid.resetGrid();
initWordGrid();
}, 1000);
}
+ clueLevel = 0; //On remet le niveau d'indice à 0
} //Fin de la fonction onClickValidateButton
//Fonction setValidateButton : permet de définir le bouton de validation
function setValidateButton(asset) {
validateButton = new Button('', {
@@ -423,8 +424,9 @@
game.addChild(validateButton);
} //Fin de la fonction setValidateButton
//Fonction onClickClueButton : permet de donner un indice au joueur
function onClickClueButton() {
+ scoreTest = "clueLevel = " + clueLevel;
switch (clueLevel) {
case 0:
//Si il n'y a qu'un seul mot dans la liste principale : on selectionne la première lettre du mot
//Si il y a plusieurs mots : on change la couleur des lettres des mots de la liste principale (mainGrid.words)
@@ -447,20 +449,46 @@
mainGrid.cells[line][col].setColorToLetter("#000000");
}
}, 2000);
}
+ //Si il y a plusieurs mots : 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");
+ LK.setTimeout(function () {
+ mainGrid.colorWordCells(word, "#000000");
+ }, 3000);
+ }
+ break;
+ case 1:
+ //On prend un mot au hasard dans la liste principale et on clique sur la première lettre (isClicked = true)
+ if (mainGrid.words.length > 0) {
+ var randomIndex = Math.floor(Math.random() * mainGrid.words.length);
+ var word = mainGrid.words[randomIndex];
+ clueWord = word; //On garde le mot pour le prochain indice
+ var firstLetter = word[0];
for (var i = 0; i < mainGrid.gridLines; i++) {
for (var j = 0; j < mainGrid.gridColumns; j++) {
- if (mainGrid.words.includes(mainGrid.cells[i][j].letter)) {
- mainGrid.cells[i][j].setColorToLetter("#00FF00");
+ if (mainGrid.cells[i][j].letter == firstLetter) {
+ mainGrid.cells[i][j].onClickCell();
}
}
}
}
break;
- case 1:
- //a definir
+ default:
+ //On applique le même indice que le niveau 2 et superieur
+ if (clueWord != '') {
+ var letter = clueWord[clueLevel - 1];
+ for (var i = 0; i < mainGrid.gridLines; i++) {
+ for (var j = 0; j < mainGrid.gridColumns; j++) {
+ if (mainGrid.cells[i][j].letter == letter) {
+ mainGrid.cells[i][j].onClickCell();
+ }
+ }
+ }
+ }
break;
} //Fin du switch
//Si possible on retranche 2 X le niveau d'indice au score (minimum 0)
if (score >= 2 * clueLevel) {
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.