Code edit (23 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: Button is not defined' in or related to this line: 'var validateButton = new Button('Validate', {' Line Number: 271
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: columnFrom is not defined' in or related to this line: 'scoreTest = columnFrom;' Line Number: 89
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: cells is not defined' in or related to this line: 'mainGrid.cells[i][j].setLetter(cells[i][j].columnFrom, cells[i][j].lineFrom, wordGrid.cells[i][j].letter);' Line Number: 346
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: newLetter.toUpperCase is not a function' in or related to this line: 'self.texte.setText(newLetter.toUpperCase());' Line Number: 71
User prompt
Please fix the bug: 'ReferenceError: cells is not defined' in or related to this line: 'mainGrid.cells[i][j].setLetter(cells[i][j].column, cells[i][j].line, wordGrid.cells[i][j].letter);' Line Number: 342
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: wordGrid.cells[i][j].removeCell is not a function' in or related to this line: 'wordGrid.cells[i][j].removeCell(j);' Line Number: 342
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: 'TypeError: self.cells[i][j] is undefined' in or related to this line: 'if (self.cells[i][j].letter !== '') {' Line Number: 192
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self.cells[i][j] is undefined' in or related to this line: 'if (self.cells[i][j].letter !== '') {' Line Number: 192
User prompt
Please fix the bug: 'TypeError: self.cells[i][j] is undefined' in or related to this line: 'if (self.cells[i][j].letter !== '') {' Line Number: 192
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: word is not defined' in or related to this line: 'cellLetter.x = game.width / 2 + cellSize * (word.length / 2);' Line Number: 285
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -37,17 +37,19 @@
* If there is no more space in the grid, the game is over.
****/
// Assets will be automatically created and loaded by the LK engine based on usage in the game code.
// GridCell class for individual letters in the grid
-var GridCell = Container.expand(function (letter) {
+var GridCell = Container.expand(function (letter, assetName) {
var self = Container.call(this);
- var cellGraphics = self.attachAsset('cell', {
+ var cellGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
+ self.clickable = true; //Indique si la cellule est cliquable
self.letter = letter;
+ self.policeSize = 128;
var text = new Text2(letter.toUpperCase(), {
- size: 128,
+ size: self.policeSize,
fill: "#ffffff"
});
self.texte = text;
self.texte.anchor.set(0.5, 0.5);
@@ -66,18 +68,18 @@
});
};
self.onClickCell = function () {
//Fonction appelée lors du click sur la cellule
- if (!self.isClicked) {
+ if (!self.clickable) {
return;
}
self.isClicked = true;
self.setColorToLetter("#FF0000");
};
self.isClicked = false; //Indique si la cellule a été cliquée
});
// LettersGrid class for managing the grid of letters, same as WordGrid but with control of number of columns and lines
-var LettersGrid = Container.expand(function (columns, lines) {
+var LettersGrid = Container.expand(function (columns, lines, assetName) {
var self = Container.call(this);
self.gridColumns = columns;
self.gridLines = lines;
self.cellSize = 1280 / self.gridColumns;
@@ -87,9 +89,9 @@
self.initializeGrid = function () {
for (var i = 0; i < self.gridLines; i++) {
self.cells[i] = [];
for (var j = 0; j < self.gridColumns; j++) {
- var cell = new GridCell('');
+ var cell = new GridCell('', assetName);
cell.x = j * self.cellSize + self.cellSize / 2;
cell.y = i * self.cellSize + self.cellSize / 2;
self.addChild(cell);
self.cells[i][j] = cell;
@@ -98,9 +100,9 @@
cell.on('down', function () {
//Fonction appelée lors du click sur la cellule
this.onClickCell();
});
- cell.clickable = !self.clickable;
+ cell.clickable = self.clickable;
self.emptyCells.push(cell);
}
}
}; //Fin de la fonction initializeGrid
@@ -154,8 +156,18 @@
}
}
return true;
}; //Fin de la fonction isFull
+ self.isEmpty = function () {
+ for (var i = 0; i < self.gridLines; i++) {
+ for (var j = 0; j < self.gridColumns; j++) {
+ if (self.cells[i][j].letter !== '') {
+ return false;
+ }
+ }
+ }
+ return true;
+ }; //Fin de la fonction isEmpty
self.colorAllCells = function (color) {
for (var i = 0; i < self.gridLines; i++) {
for (var j = 0; j < self.gridColumns; j++) {
self.cells[i][j].setColorToLetter(color);
@@ -195,13 +207,15 @@
anchorX: 0.5,
anchorY: 0
});
LK.gui.top.addChild(scoreTestText);
-var lettersGrid = game.addChild(new LettersGrid(3, 1));
+var policeSize = 128;
+var lettersGrid = game.addChild(new LettersGrid(3, 1, 'cell'));
+lettersGrid.clickable = false;
lettersGrid.initializeGrid();
lettersGrid.x = (game.width - lettersGrid.gridColumns * lettersGrid.cellSize) / 2;
lettersGrid.y = ScoreZone.height + lettersGrid.height / 2;
-var mainGrid = game.addChild(new LettersGrid(6, 6));
+var mainGrid = game.addChild(new LettersGrid(6, 6, 'cellWord'));
mainGrid.initializeGrid();
mainGrid.x = (game.width - mainGrid.gridColumns * mainGrid.cellSize) / 2;
mainGrid.y = ScoreZone.height + 2 * lettersGrid.height;
var lettersToAdd = [];
@@ -209,8 +223,9 @@
var wordsToBegin = pickAndShakeWords(1); // Pick and shuffle words from the main list
if (wordsToBegin.length > 0) {
// If there are words to begin
stackLettersFromWords(wordsToBegin); // Stack letters from words to add them to the grid
+ transfertLettersToGrid(); // Transfer letters to the grid
}
/****
* Functions
****/
@@ -245,17 +260,24 @@
lettersToAdd.push(letters[j]);
}
}
} //Fin de la fonction stackLettersFromWords
+//Fonction transfertLettersToGrid : permet de transférer les lettres de la liste lettersToAdd dans la grille principale
+function transfertLettersToGrid() {
+ for (var i = 0; i < lettersGrid.gridColumns && lettersToAdd.length > 0; i++) {
+ mainGrid.addRandomLetter(lettersToAdd[0]);
+ lettersToAdd.splice(0, 1);
+ }
+} //Fin de la fonction transfertLettersToGrid
game.update = function () {
updateScoreTest(scoreTest);
if (LK.ticks % 60 == 0) {
- //Si la liste des lettres à ajouter n'est pas vide, on ajoute toutes les lettres puis on vide la liste
- if (lettersToAdd.length > 0) {
- for (var i = 0; i < lettersToAdd.length; i++) {
- lettersGrid.addRandomLetter(lettersToAdd[i]);
+ //Si la liste des lettres à ajouter n'est pas vide, on ajoute toutes les lettres puis on supprime les lettres de la liste
+ if (lettersToAdd.length > 0 && lettersGrid.isEmpty()) {
+ for (var i = 0; i < lettersGrid.gridColumns && lettersToAdd.length > 0; i++) {
+ lettersGrid.addRandomLetter(lettersToAdd[0]);
+ lettersToAdd.splice(0, 1);
}
- lettersToAdd = [];
}
currentLetterIndex = (currentLetterIndex + 1) % lettersToAdd.length;
if (mainGrid.isFull()) {
mainGrid.colorAllCells("#FF0000");
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.