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
@@ -222,9 +222,9 @@
/****
* Game Code
****/
-//var wordsMainListTest = ["AARDVARK", "ALBATROSS", "ALLIGATOR", "ALPACA", "ANT"]; //The real main list is at the end
+// 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.
@@ -252,33 +252,53 @@
* 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 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 scoreTest = 0; // Define scoreTest variable
var score = 0;
+/****
+* Game zones and backgrounds
+****/
var ScoreZone = {
x: 0,
y: 0,
width: game.width,
- height: 200
+ height: 200 * game.height / 2732
};
+var MainZone = {
+ x: 0,
+ y: ScoreZone.height,
+ width: game.width,
+ height: game.height - 2 * ScoreZone.height
+};
+var OptionsZone = {
+ x: 0,
+ y: game.height - ScoreZone.height,
+ width: game.width,
+ height: 200 * game.height / 2732
+};
var backGroundScoreZone = LK.getAsset('ScoreZoneBackGround', {
x: ScoreZone.x,
y: ScoreZone.y,
width: ScoreZone.width,
height: ScoreZone.height
});
game.addChild(backGroundScoreZone);
-var OptionsZone = {
- x: 0,
- y: game.height - 200,
- width: game.width,
- height: 200
-};
+setBackGroundImage('BackGroundPlanetesNSatellites');
+var backGroundOptionsZone = LK.getAsset('OptionsZoneBackGround', {
+ x: OptionsZone.x,
+ y: OptionsZone.y,
+ width: OptionsZone.width,
+ height: OptionsZone.height
+});
+game.addChild(backGroundOptionsZone);
+/****
+* Score
+****/
var scoreTestText = new Text2('0', {
size: 30,
fill: "#ffff00",
anchorX: 0.5,
@@ -291,27 +311,25 @@
anchorX: 0.5,
anchorY: 0
});
LK.gui.top.addChild(scoreText);
+/****
+* Main zone foreground
+****/
var policeSize = 128;
-var lettersGrid = new LettersGrid(1, 1, 'cell');
-lettersGrid.clickable = false;
-lettersGrid.initializeGrid();
-lettersGrid.x = (game.width - lettersGrid.width) / 2 + lettersGrid.height / 2;
-lettersGrid.y = ScoreZone.height + lettersGrid.height / 2;
-setMainWordsList(planetesNsatellites);
-setBackGroundImage('BackGroundPlanetesNSatellites');
-setValidateButton('buttonValidate');
+var oneCell = new LettersGrid(1, 1, 'cell'); //Taille de reference
var mainGrid = game.addChild(new LettersGrid(6, 6, 'cell'));
mainGrid.initializeGrid();
-mainGrid.x = (game.width - mainGrid.width) / 2 + lettersGrid.height / 2;
-mainGrid.y = ScoreZone.height + 2 * lettersGrid.height;
+mainGrid.x = mainGrid.columns * oneCell.width / 2;
+mainGrid.y = MainZone.height / 6;
var wordGrid = null;
initWordGrid();
var lettersToAdd = []; //File d'attente des lettres à ajouter dans la lettersGrid
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);
+setValidateButton('buttonValidate');
/****
* Functions
****/
function updateScoreTest(nouveauScore) {
@@ -326,12 +344,12 @@
} //Fin de la fonction setMainWordsList
//Fonction setBackGroundImage : permet de définir l'image de fond du jeu
function setBackGroundImage(image) {
backGroundImage = LK.getAsset(image, {
- x: 0,
- y: ScoreZone.height,
- width: game.width,
- height: game.height - OptionsZone.height
+ x: MainZone.x,
+ y: MainZone.y,
+ width: MainZone.width,
+ height: MainZone.height
});
game.addChild(backGroundImage);
} //Fin de la fonction setBackGroundImage
//Fonction onClickValidateButton : permet de valider le mot formé par le joueur
@@ -369,10 +387,10 @@
fill: "#00FF00",
text: {
size: 50,
fill: "#000000"
- }
- //onClick: onClickValidateButton
+ },
+ onClick: onClickValidateButton
});
game.addChild(validateButton);
} //Fin de la fonction setValidateButton
//Fonction initWordGrid : permet d'initialiser la grille des lettres formant le mot
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.