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
Code edit (1 edits merged)
Please save this source code
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: 'TypeError: wordsMainList is undefined' in or related to this line: 'var randomIndex = Math.floor(Math.random() * wordsMainList.length);' Line Number: 382
Code edit (4 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 = word.split('').sort(function () {' Line Number: 394
User prompt
Please fix the bug: 'TypeError: liste is undefined' in or related to this line: 'var randomIndex = Math.floor(Math.random() * liste.length);' Line Number: 390
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: wordsMainList is undefined' in or related to this line: 'var randomIndex = Math.floor(Math.random() * wordsMainList.length);' Line Number: 381
Code edit (1 edits merged)
Please save this source code
Code edit (19 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.Sprite is not a constructor' in or related to this line: 'var backGroundImage = game.addChild(new LK.Sprite('BackGroundImage', {' Line Number: 268
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: cell is not defined' in or related to this line: 'scoreTest += cell.letter;' Line Number: 401
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: '[Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: https://beta.frvr.ai/game-template/index-0.0.3.html?frame_id=0&v2=1&1715679717556&disable_analytics=1 line 181 > injectedScript :: execute/window.getRenderer/t.Text.prototype.updateText :: line 1" data: no]' in or related to this line: 'scoreTestText.setText(nouveauScore);' Line Number: 357
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
===================================================================
--- original.js
+++ change.js
@@ -1,42 +1,10 @@
/****
* Classes
****/
-/****
-* GAME DESCRIPTION:
-* Game Principle:
- * -There is a board filled with letters, where the player selects letters from a partially filled grid.
- * -With these letters, the player forms a word that appears below the grid, then validates their word.
- * -If the word is among the main list, it is valid, and the player earns points.
- * -The score obtained is proportional to the length of the word.
- * -These letters move randomly within the grid to empty spaces.
- * -If the word is not valid, the letters forming the word are returned to their original position in the grid.
- * -A new word is selected from the main list, shuffled and randomly dispatched in the empty cells.
- * -If there is no more space in the grid, the game is over.
-* Game Areas:
- * The screen is divided into 5 main zones in the following descending order:
- 1. Score area: displays the player's score.
- 2. The grid: the letter grid (main grid).
- 3. Word area: displays the word formed by the player (word grid).
- 4. Validation area: button to validate the word or erase letters.
- 5. Options area (or advertisement).
-* Game Progression:
- * At the beginning of the game, the grid is almost empty, containing one shuffled word.
- * The player can choose a letter in the grid by clicking on it.
- * The chosen letter is added to the word area.
- * The player can validate the word or erase a letter by clicking on the letter in the word, which then returns to its place in the grid.
- * When the player thinks he has formed a word, he can validate it with the validate button located below the word area.
- * If the word is valid, the player earns points, and the score is updated.
- * 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 Button = Container.expand(function (image, text) {
+var Button = Container.expand(function (text, options) {
var self = Container.call(this);
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var buttonGraphics = self.attachAsset(image, {
- image: image || 'buttonValidate',
+ var buttonGraphics = self.attachAsset(options.assetName || 'button', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = options.width || 200;
@@ -255,8 +223,41 @@
/****
* Game Code
****/
//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.
+ * -With these letters, the player forms a word that appears below the grid, then validates their word.
+ * -If the word is among the main list, it is valid, and the player earns points.
+ * -The score obtained is proportional to the length of the word.
+ * -These letters move randomly within the grid to empty spaces.
+ * -If the word is not valid, the letters forming the word are returned to their original position in the grid.
+ * -A new word is selected from the main list, shuffled and randomly dispatched in the empty cells.
+ * -If there is no more space in the grid, the game is over.
+* Game Areas:
+ * The screen is divided into 5 main zones in the following descending order:
+ 1. Score area: displays the player's score.
+ 2. The grid: the letter grid (main grid).
+ 3. Word area: displays the word formed by the player (word grid).
+ 4. Validation area: button to validate the word or erase letters.
+ 5. Options area (or advertisement).
+* Game Progression:
+ * At the beginning of the game, the grid is almost empty, containing one shuffled word.
+ * The player can choose a letter in the grid by clicking on it.
+ * The chosen letter is added to the word area.
+ * The player can validate the word or erase a letter by clicking on the letter in the word, which then returns to its place in the grid.
+ * When the player thinks he has formed a word, he can validate it with the validate button located below the word area.
+ * If the word is valid, the player earns points, and the score is updated.
+ * 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 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;
var ScoreZone = {
x: 0,
@@ -270,9 +271,8 @@
width: ScoreZone.width,
height: ScoreZone.height
});
game.addChild(backGroundScoreZone);
-setBackGroundImage('BackGroundPlanetesNSatellites');
var OptionsZone = {
x: 0,
y: game.height - 200,
width: game.width,
@@ -283,35 +283,11 @@
fill: "#ffff00",
anchorX: 0.5,
anchorY: 0
});
-LK.gui.topLeft.addChild(scoreTestText);
-var scoreText = new Text2('0', {
- size: 100,
- fill: "#00ff00",
- anchorX: 0.5,
- anchorY: 0
-});
-LK.gui.top.addChild(scoreText);
-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;
-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;
-var wordGrid = null;
-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"];
-//Liste principale des mots
-//var wordsMainList = animaux || [];
-setMainWordsList(planetesNsatellites);
initWordGrid();
-var validateButton = new Button('buttonValidate', {
+var validateButton = new Button('', {
+ assetName: 'buttonValidate',
x: game.width / 2,
y: wordGrid.y + wordGrid.height + 400,
width: 300,
height: 300,
@@ -344,8 +320,30 @@
}, 1000);
}
}
});
+LK.gui.topLeft.addChild(scoreTestText);
+var scoreText = new Text2('0', {
+ size: 100,
+ fill: "#00ff00",
+ anchorX: 0.5,
+ anchorY: 0
+});
+LK.gui.top.addChild(scoreText);
+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');
+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;
+var wordGrid = null;
+initWordGrid();
game.addChild(validateButton);
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
@@ -372,12 +370,18 @@
height: game.height
});
game.addChild(backGroundImage);
} //Fin de la fonction setBackGroundImage
+//Fonction setButtonAsset : permet de définir l'asset d'un bouton
+function setButtonAsset(button, asset) {
+ button.assetName = asset;
+} //Fin de la fonction setButtonAsset
//Fonction initWordGrid : permet d'initialiser la grille des lettres formant le mot
function initWordGrid() {
//Initialise la grille des lettres formant le mot
- wordGrid = game.addChild(new LettersGrid(0, 1, 'cellWord'));
+ if (!wordGrid) {
+ wordGrid = game.addChild(new LettersGrid(0, 1, 'cellWord'));
+ }
wordGrid.initializeGrid();
wordGrid.x = (game.width - wordGrid.width) / 2 - wordGrid.height / 2;
wordGrid.y = ScoreZone.height + 300 + mainGrid.height + 200;
} //Fin de la fonction initWordGrid
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.