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
User prompt
Please fix the bug: 'Timeout.tick error: options is undefined' in or related to this line: 'var imageToScrollRescale = {' Line Number: 775
Code edit (15 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: options is undefined' in or related to this line: 'var imageToScrollRescale = {' Line Number: 775
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: options is undefined' in or related to this line: 'var imageToScrollRescale = {' Line Number: 748
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: createRewardImages is not defined' in or related to this line: 'createRewardImages('RewardsCoin', tableauFrom);' Line Number: 469
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: 'TypeError: imagesToScrollRescale[i] is undefined' in or related to this line: 'if (imagesToScrollRescale[i].isDestroyedOnEnd) {' Line Number: 725
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: backGroundOptionsZone is not defined' in or related to this line: 'game.addChild(backGroundOptionsZone);' Line Number: 351
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: setScore is not defined' in or related to this line: 'setScore(0);' Line Number: 396
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: clueWord is not defined' in or related to this line: 'if (clueWord != '') {' Line Number: 601
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -290,8 +290,10 @@
* 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 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"];
@@ -355,27 +357,38 @@
* Main zone foreground
****/
var policeSize = 128;
var mainGrid = game.addChild(new LettersGrid(6, 6, 'cell'));
-mainGrid.initializeGrid();
-mainGrid.x = game.width / 2 - mainGrid.width / 2 + mainGrid.width / (mainGrid.gridColumns + 2);
-mainGrid.y = MainZone.height / 6;
var wordGrid = null;
-initWordGrid();
var isGameStarted = false;
var isMGRefillrequired = false; //Indique si le remplissage de la grille principale est nécessaire
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');
-setClueButtonWord('ButtonClue1');
-setClueButtonDrop('ButtonClue2');
+initGameThema(planetesNsatellites, 'BackGroundPlanetesNSatellites');
/****
* Functions
****/
+//Fonction initGameThema : permet d'initialiser le thème du jeu (liste des mots et image de fond)
+function initGameThema(mainList, backGround) {
+ setMainWordsList(mainList);
+ setBackGroundImage(backGround);
+ LK.setScore(0);
+ mainGrid.initializeGrid();
+ mainGrid.initializeGrid();
+ mainGrid.x = game.width / 2 - mainGrid.width / 2 + mainGrid.width / (mainGrid.gridColumns + 2);
+ mainGrid.y = MainZone.height / 6;
+ initWordGrid();
+ isGameStarted = false;
+ isMGRefillrequired = false;
+ isWordValid = false;
+ clueLevel = 0;
+ setValidateButton('buttonValidate');
+ setClueButton('buttonClue');
+ setClueButtonWord('ButtonClue1');
+ setClueButtonDrop('ButtonClue2');
+} //Fin de la fonction initGameThema
function updateScoreTest(nouveauScore) {
scoreTestText.setText(nouveauScore);
} //fin updateScoreTest
function updateScore(nouveauScore) {
@@ -438,76 +451,35 @@
game.addChild(validateButton);
} //Fin de la fonction setValidateButton
//Fonction onClickClueButton : permet de donner un indice au joueur
function onClickClueButton() {
- if (!wordGrid.isEmpty() && clueLevel == 0) {
+ if (!wordGrid.isEmpty()) {
//Si le joueur a déjà commencé à former un mot, on ne donne pas d'indice
return;
}
- 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)
- if (mainGrid.words.length == 1) {
- var firstLetter = mainGrid.words[0][0];
- var line = -1;
- var col = -1;
- for (var i = 0; i < mainGrid.gridLines; i++) {
- //On colorie la première lettre du mot pendant 2 secondes
- for (var j = 0; j < mainGrid.gridColumns; j++) {
- if (mainGrid.cells[i][j].letter == firstLetter) {
- mainGrid.cells[i][j].setColorToLetter("#FF5500");
- line = i;
- col = j;
- }
- }
+ if (mainGrid.words.length >= 1) {
+ var randomIndex = Math.floor(Math.random() * mainGrid.words.length);
+ var word = mainGrid.words[randomIndex];
+ var firstLetter = word[0];
+ var line = -1;
+ var col = -1;
+ for (var i = 0; i < mainGrid.gridLines; i++) {
+ //On colorie la première lettre du mot pendant 2 secondes
+ for (var j = 0; j < mainGrid.gridColumns; j++) {
+ if (mainGrid.cells[i][j].letter == firstLetter) {
+ mainGrid.cells[i][j].setColorToLetter("#FF5500");
+ line = i;
+ col = j;
+ break;
}
- LK.setTimeout(function () {
- if (mainGrid.cells[line] && mainGrid.cells[line][col]) {
- 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);
+ }
+ LK.setTimeout(function () {
+ if (mainGrid.cells[line] && mainGrid.cells[line][col]) {
+ mainGrid.cells[line][col].setColorToLetter("#000000");
}
- 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];
- var secondLetter = word[1];
- mainGrid.findNclickCell(firstLetter);
- LK.setTimeout(function () {
- mainGrid.findNclickCell(secondLetter);
- }, 100);
- }
- break;
- default:
- //On descend les lettres d'un mot
- if (typeof clueWord !== 'undefined' && clueWord != '') {
- var letter = clueWord[clueLevel - 1];
- mainGrid.findNclickCell(letter);
- }
- break;
- } //Fin du switch
- //Si possible on retranche 2 X le niveau d'indice au score (minimum 0)
- if (score >= 2 * clueLevel) {
- score -= 2 * clueLevel;
- } else {
- score = 0;
+ }, 2000);
}
- clueLevel++;
} //Fin de la fonction onClickClueButton
//Fonction setClueButton : permet de définir le bouton d'indice
function setClueButton(asset) {
clueButton = new Button('', {
@@ -578,15 +550,19 @@
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];
+ var secondLetter = word[1];
mainGrid.findNclickCell(firstLetter);
+ LK.setTimeout(function () {
+ mainGrid.findNclickCell(secondLetter);
+ }, 100);
}
break;
default:
//On descend les lettres d'un mot
if (clueWord != '') {
- var letter = clueWord[clueLevel];
+ var letter = clueWord[clueLevel + 1];
mainGrid.findNclickCell(letter);
}
break;
} //Fin du switch
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.