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
@@ -304,20 +304,19 @@
* If there is no more space in the grid, the game is over.
****/
var backGroundsList = ["BackGroundPlanetesNSatellites", "BackGroundUSAStates", "BackGroundEuropeanCapitales"]; //Liste des assets de fond
var mainListsList = [planetesNsatellites, usaStates, europeanCapitales]; //Liste des listes de mots principales
-//var wordsMainListTest = ["AARDVARK", "ALBATROSS", "ALLIGATOR", "ALPACA", "ANT"]; //The real main list is at the end
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 planetesNsatellites = ["SUN", "MERCURY", "VENUS", "EARTH", "MOON", "MARS"];
+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
var isScoreUpdatable = false; // Autorise ou pas la mise à jour du score
-var score = 0;
+var score = 50;
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 rewardForEmpty = 50;
/****
* Game zones and backgrounds
****/
var ScoreZone = {
@@ -361,9 +360,9 @@
anchorX: 0.5,
anchorY: 0
});
LK.gui.topLeft.addChild(scoreTestText);
-var scoreText = new Text2('0', {
+var scoreText = new Text2(score, {
size: 100,
fill: "#00ff00",
anchorX: 0.5,
anchorY: 0
@@ -384,11 +383,11 @@
var clueButtonWord = null;
var clueButtonDrop = null;
var animatingImageOn = false; //Drapeau indiquant qu'une image est a scrollscaller
var imagesToScrollRescale = []; //Liste des images a scrollscaller
-//initGameThema(planetesNsatellites, 'BackGroundPlanetesNSatellites');
+initGameThema(planetesNsatellites, 'BackGroundPlanetesNSatellites');
//initGameThema(usaStates, 'BackGroundUSAStates');
-initGameThema(europeanCapitales, 'BackGroundEuropeanCapitales');
+//initGameThema(europeanCapitales, 'BackGroundEuropeanCapitales');
/****
* Functions
****/
//Fonction initGameThema : permet d'initialiser le thème du jeu (liste des mots et image de fond)
@@ -404,11 +403,11 @@
mainGrid.y = MainZone.height / 6;
game.addChild(mainGrid);
initWordGrid();
setValidateButton('buttonValidate');
- setClueButtonFirstLetter('buttonClue');
- setClueButtonWord('ButtonClue1');
- setClueButtonDrop('ButtonClue2');
+ setClueButtonFirstLetter('ButtonClueLetter');
+ setClueButtonWord('ButtonClueWord');
+ setClueButtonDrop('ButtonClueDrop');
} //Fin de la fonction initGameThema
function updateScoreTest(nouveauScore) {
scoreTestText.setText(nouveauScore);
} //fin updateScoreTest
@@ -458,9 +457,9 @@
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: 100,
+ valueToAddToScore: rewardForEmpty,
soundOnEnd: 'SoundEmptyGrid',
isDestroyedOnEnd: true,
animate: true
});
@@ -523,9 +522,13 @@
}
LK.setTimeout(function () {
if (mainGrid.cells[line] && mainGrid.cells[line][col]) {
mainGrid.cells[line][col].setColorToLetter("#000000");
- scrollCostCoins(clueButtonLetter.x, clueButtonLetter.y, 1, 10);
+ if (score >= costForLetter) {
+ scrollCostCoins(clueButtonLetter.x, clueButtonLetter.y, 1, costForLetter);
+ } else {
+ score -= costForLetter;
+ }
}
}, 2000);
}
} //Fin de la fonction onClickClueButtonLetter
@@ -594,9 +597,9 @@
}
switch (clueLevel) {
case 0:
//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) {
+ if (mainGrid.words.length > 0 && wordGrid.isEmpty()) {
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];
@@ -818,9 +821,8 @@
if (liste[i].length > longuest.length) {
longuest = liste[i];
}
}
- scoreTest = "Longuest : " + longuest;
return longuest.length;
} //Fin de la fonction longuestWord
/****
* Main loop
@@ -857,16 +859,21 @@
validateButton.visible = true;
}
}
//Affichage ou pas des boutons d'indices
+ if (!wordGrid.isEmpty()) {
+ clueButtonLetter.visible = false;
+ } else {
+ clueButtonLetter.visible = true;
+ }
var notEnoughtMoneyForWord = longuestWord(mainGrid.words) * costForWord > score;
if (notEnoughtMoneyForWord || !wordGrid.isEmpty()) {
clueButtonWord.visible = false;
} else {
clueButtonWord.visible = true;
}
var notEnoughtMoneyForDrop = longuestWord(mainGrid.words) * costForDrop > score;
- if (notEnoughtMoneyForDrop || !wordGrid.isEmpty()) {
+ if (notEnoughtMoneyForDrop || clueWord == '' && !wordGrid.isEmpty() || wordGrid.words.length > 0 && clueWord.length < wordGrid.words[0].length) {
clueButtonDrop.visible = false;
} else {
clueButtonDrop.visible = true;
}
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.