Code edit (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: periodic is not defined' in or related to this line: 'var mainListsList = [planetesNsatellites, usaStates, europeanCapitales, animals, periodic]; //Liste des listes de mots principales' Line Number: 349
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: 'Uncaught ReferenceError: oneCell is not defined' in or related to this line: 'nameGrid.width = miniBackGrounds[i].width - 2 * oneCell.cellSize;' Line Number: 455
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: x is not defined' in or related to this line: 'x += width;' Line Number: 451
Code edit (1 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: 'scoreTest = "Thema : " + this.assetName + "mainListSize : " + mainList.length;' Line Number: 464
Code edit (4 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: 'scoreTest = "Thema : " + this.assetName + "mainListSize : " + this.mainList.length;' Line Number: 459
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -280,8 +280,9 @@
/****
* Game Code
****/
+// Button class for creating buttons in the game
/****
* GAME DESCRIPTION:
* Game Principle:
* -There is a board filled with letters, where the player selects letters from a partially filled grid.
@@ -309,9 +310,8 @@
* 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.
****/
-// Button class for creating buttons in the game
var backGroundsList = ["BackGroundPlanetesNSatellites", "BackGroundUSAStates", "BackGroundEuropeanCapitales"]; //Liste des assets de fond
var mainListsList = [planetesNsatellites, usaStates, europeanCapitales]; //Liste des listes de mots principales
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"];
@@ -382,9 +382,10 @@
****/
var policeSize = 128;
var mainGrid = new LettersGrid(6, 6, 'cell');
var wordGrid = null;
-var isGameStarted = false;
+var isGameStarted = false; //Indique si le jeu a commencé dans un thème
+var isThemaSelected = false; //Indique si un thème a été sélectionné
var isMGRefillrequired = false; //Indique si le remplissage de la grille principale est nécessaire
var isWordValid = false; //Indique si le mot formé est valide
var isWordInMainList = false; //Indique si le mot formé est dans la liste principale
var validateButton = null;
@@ -394,31 +395,49 @@
var animatingImageOn = false; //Drapeau indiquant qu'une image est a scrollscaller
var imagesToScrollRescale = []; //Liste des images a scrollscaller
//initGameThema(planetesNsatellites, 'BackGroundPlanetesNSatellites');
//initGameThema(usaStates, 'BackGroundUSAStates');
-initGameThema(europeanCapitales, 'BackGroundEuropeanCapitales');
+//isThemaSelected = true;
+//initGameThema(europeanCapitales, 'BackGroundEuropeanCapitales');
+displayminiBackGrounds();
/****
* Functions
****/
//Fonction displayminiBackGrounds : permet d'afficher les miniatures des fonds et d'y associer un événement de click
//Les assets de fond sont stockés dans la liste backGroundsList
function displayminiBackGrounds() {
- var backGrounds = [];
+ var miniBackGrounds = [];
+ var x = 0;
+ var y = game.height / 2;
+ var width = game.width / backGroundsList.length;
+ var height = MainZone.height;
for (var i = 0; i < backGroundsList.length; i++) {
- backGrounds[i] = LK.getAsset(backGroundsList[i], {
- x: 100 * i,
- y: 0,
- width: 100,
- height: 100
+ miniBackGrounds[i] = new Button('', {
+ assetName: backGroundsList[i],
+ x: x,
+ y: y,
+ width: width,
+ height: height,
+ fill: "#00FF00",
+ text: {
+ size: 50,
+ fill: "#000000"
+ },
+ onClick: onClickMiniBackGround
});
- backGrounds[i].on('down', function () {
- if (!isGameStarted) {
- initGameThema(mainListsList[i], backGroundsList[i]);
- }
- });
- game.addChild(backGrounds[i]);
+ game.addChild(miniBackGrounds[i]);
+ x += width;
}
} //Fin de la fonction displayminiBackGrounds
+//Fonction onClickMiniBackGround : permet de sélectionner un thème de jeu
+function onClickMiniBackGround() {
+ scoreTest = "Thema : " + this.assetName;
+ if (!isThemaSelected) {
+ var i = backGroundsList.indexOf(this.assetName);
+ initGameThema(mainListsList[i], backGroundsList[i]);
+ isThemaSelected = true;
+ }
+} //Fin de la fonction onClickMiniBackGround
//Fonction initGameThema : permet d'initialiser le thème du jeu (liste des mots et image de fond)
function initGameThema(mainList, backGround) {
isGameStarted = false;
isMGRefillrequired = false;
@@ -734,9 +753,8 @@
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 list : " + word;
isWordValid = true;
isWordInMainList = true;
wordsMainList.splice(wordsMainList.indexOf(word), 1); //Retire le mot de la liste principale
} else {
@@ -868,8 +886,12 @@
/****
* Main loop
****/
game.update = function () {
+ //Choix du thème
+ if (!isThemaSelected) {
+ return;
+ }
//Mise à jour score
//scoreTest = "Words left: " + wordsMainList.length;
updateScoreTest(scoreTest);
if (isScoreUpdatable) {
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.