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
@@ -236,9 +236,9 @@
/****
* Game Code
****/
-// Button class for creating buttons in the game
+//var wordsMainListTest = ["AARDVARK", "ALBATROSS", "ALLIGATOR", "ALPACA", "ANT"]; //The real main list is at the end
/****
* GAME DESCRIPTION:
* Game Principle:
* -There is a board filled with letters, where the player selects letters from a partially filled grid.
@@ -266,9 +266,9 @@
* If the word is not valid, the letters forming the word are returned to their original position in the grid.
* A new word appears randomly within the grid to empty spaces.
* If there is no more space in the grid, the game is over.
****/
-//var wordsMainListTest = ["AARDVARK", "ALBATROSS", "ALLIGATOR", "ALPACA", "ANT"]; //The real main list is at the end
+// Button class for creating buttons in the game
var usaStates = ["ALABAMA", "ALASKA", "ARIZONA", "ARKANSAS", "CALIFORNIA", "COLORADO", "CONNECTICUT", "DELAWARE", "FLORIDA", "GEORGIA", "HAWAII", "IDAHO", "ILLINOIS", "INDIANA", "IOWA", "KANSAS", "KENTUCKY", "LOUISIANA", "MAINE", "MARYLAND", "MASSACHUSETTS", "MICHIGAN", "MINNESOTA", "MISSISSIPPI", "MISSOURI", "MONTANA", "NEBRASKA", "NEVADA", "NEW-HAMPSHIRE", "NEW-JERSEY", "NEW-MEXICO", "NEW-YORK", "NORTH-CAROLINA", "NORTH-DAKOTA", "OHIO", "OKLAHOMA", "OREGON", "PENNSYLVANIA", "RHODE-ISLAND", "SOUTH-CAROLINA", "SOUTH-DAKOTA", "TENNESSEE", "TEXAS", "UTAH", "VERMONT", "VIRGINIA", "WASHINGTON", "WEST-VIRGINIA", "WISCONSIN", "WYOMING"];
var europeanCapitales = ["AMSTERDAM", "ANDORRA-LA-VELLA", "ANKARA", "ATHENS", "BELGRADE", "BERLIN", "BERN", "BRATISLAVA", "BRUSSELS", "BUCHAREST", "BUDAPEST", "CHISINAU", "COPENHAGEN", "DUBLIN", "HELSINKI", "KIEV", "LISBON", "LJUBLJANA", "LONDON", "LUXEMBOURG", "MADRID", "MINSK", "MONACO", "MOSCOW", "NICOSIA", "OSLO", "PARIS", "PODGORICA", "PRAGUE", "REYKJAVIK", "RIGA", "ROME", "SAN-MARINO", "SARAJEVO", "SKOPJE", "SOFIA", "STOCKHOLM", "TALLINN", "TBILISI", "TIRANA", "VADUZ", "VALLETTA", "VIENNA", "VILNIUS", "WARSAW", "ZAGREB"];
var planetesNsatellites = ["SUN", "MERCURY", "VENUS", "EARTH", "MOON", "MARS", "PHOBOS", "DEIMOS", "JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO", "SATURN", "TITAN", "MIMAS", "ENCELADUS", "TETHYS", "DIONE", "RHEA", "HYPERION", "LAPETUS", "PHOEBE", "URANUS", "PUCK", "MIRANDA", "ARIEL", "UMBRIEL", "TITANIA", "OBERON", "NEPTUNE", "TRITON", "PROTEUS", "NEREID", "PLUTO", "CHARON"];
var scoreTest = 0; // Define scoreTest variable
@@ -341,8 +341,9 @@
var isWordValid = false; //Indique si le mot formé est valide
setMainWordsList(planetesNsatellites);
var validateButton = null;
setValidateButton('buttonValidate');
+var clueLevel = 0; //Niveau d'indice
var clueButton = new Button('', {});
setClueButton('buttonClue');
/****
* Functions
@@ -409,26 +410,57 @@
game.addChild(validateButton);
} //Fin de la fonction setValidateButton
//Fonction onClickClueButton : permet de donner un indice au joueur
function onClickClueButton() {
- return; //Pas encore implémenté
+ switch (clueLevel) {
+ case 0:
+ scoreTest = "clue level 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)
+ if (wordsMainList.length == 1) {
+ var firstLetter = wordsMainList[0][0];
+ for (var i = 0; i < mainGrid.gridLines; i++) {
+ for (var j = 0; j < mainGrid.gridColumns; j++) {
+ if (mainGrid.cells[i][j].letter == firstLetter) {
+ mainGrid.cells[i][j].setColorToLetter("#00FF00");
+ }
+ }
+ }
+ }
+ if (wordsMainList.length > 1) {
+ 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");
+ }
+ }
+ }
+ }
+ break;
+ case 1:
+ scoreTest = "clue level 1";
+ //a definir
+ break;
+ } //Fin du switch
+ clueLevel++;
} //Fin de la fonction onClickClueButton
//Fonction setClueButton : permet de définir le bouton d'indice
function setClueButton(asset) {
clueButton = new Button('', {
assetName: asset,
x: game.width / 2 - 350,
y: 150,
// Set a default y position
- width: 100,
- height: 100,
+ width: 200,
+ height: 200,
fill: "#00FF00",
text: {
size: 50,
fill: "#000000"
},
onClick: onClickClueButton
});
+ clueButton.x = game.width - clueButton.width; // Adjust x position after initialization
clueButton.y = clueButton.height / 2; // Adjust y position after initialization
game.addChild(clueButton);
} //Fin de la fonction setClueButton
//Fonction initWordGrid : permet d'initialiser la grille des lettres formant le mot
@@ -497,9 +529,8 @@
/****
* Main loop
****/
game.update = function () {
- scoreTest = wordGrid.width;
updateScoreTest(scoreTest);
updateScore(score);
//Recherche de la lettre cliquée dans la mainGrid et ajout de la lettre à la liste des lettres formant le mot
for (var i = 0; i < mainGrid.gridLines; i++) {
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.