Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -69,9 +69,9 @@
});
};
self.onClickCell = function () {
//Fonction appelée lors du click sur la cellule
- if (!self.clickable) {
+ if (!self.clickable || self.letter == '') {
return;
}
self.isClicked = true;
self.setColorToLetter("#FF0000");
@@ -82,9 +82,8 @@
var LettersGrid = Container.expand(function (columns, lines, assetName) {
var self = Container.call(this);
self.gridColumns = columns;
self.gridLines = lines;
- //self.cellSize = 200;
self.clickable = true; //Indique si la grille est cliquable
self.cells = [];
self.emptyCells = []; //Liste des cellules vides
self.initializeGrid = function () {
@@ -122,13 +121,26 @@
//Fonction appelée lors du click sur la cellule
this.onClickCell();
});
cell.clickable = self.clickable;
- self.emptyCells.push(cell);
+ if (letter === '') {
+ self.emptyCells.push(cell);
+ }
self.gridColumns++;
+ self.x -= cell.cellSize / 2; //Repositionnement de la grille
}
return cell;
}; //Fin de la fonction addCell
+ self.removeCell = function (index) {
+ //Only when there is only one gridLine, remove a cell from the grid at the given index
+ if (self.gridLines === 1 && index >= 0 && index < self.gridColumns) {
+ var cell = self.cells[0][index];
+ self.removeChild(cell);
+ self.cells[0].splice(index, 1);
+ self.gridColumns--;
+ self.x += cell.cellSize / 2; //Repositionnement de la grille
+ }
+ }; //Fin de la fonction removeCell
self.addLetter = function (letter) {
var added = false;
for (var i = 0; i < self.gridLines && !added; i++) {
for (var j = 0; j < self.gridColumns && !added; j++) {
@@ -233,17 +245,17 @@
var policeSize = 128;
var lettersGrid = game.addChild(new LettersGrid(3, 1, 'cell'));
lettersGrid.clickable = false;
lettersGrid.initializeGrid();
-lettersGrid.x = (game.width - lettersGrid.width) / 2;
+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;
+mainGrid.x = (game.width - mainGrid.width) / 2 + lettersGrid.height / 2;
mainGrid.y = ScoreZone.height + 2 * lettersGrid.height;
-var wordGrid = game.addChild(new LettersGrid(1, 1, 'cell'));
+var wordGrid = game.addChild(new LettersGrid(1, 1, 'cellWord'));
wordGrid.initializeGrid();
-wordGrid.x = (game.width - wordGrid.width) / 2;
+wordGrid.x = (game.width - wordGrid.width) / 2 - wordGrid.height / 2 + lettersGrid.height / 2;
wordGrid.y = ScoreZone.height + lettersGrid.height + mainGrid.height + 2 * lettersGrid.height;
var lettersToAdd = [];
var currentLetterIndex = 0;
var wordsToBegin = pickAndShakeWords(1); // Pick and shuffle words from the main list
@@ -295,13 +307,36 @@
}
} //Fin de la fonction transfertLettersToMainGrid
//Fonction addCellLetterToWord : permet d'ajouter une cellule à la liste des lettres formant le mot situé sous la grille
function addCellLetterToWord(letter) {
- var cellLetter = new GridCell(letter, 'cell');
+ var cellLetter = new GridCell(letter, 'cellWord');
wordGrid.addCell(letter, 'cell');
} //Fin de la fonction addCellLetterToWord
game.update = function () {
updateScoreTest(scoreTest);
+ //Recherche de la lettre cliquée et ajout de la lettre à la liste des lettres formant le mot
+ for (var i = 0; i < mainGrid.gridLines; i++) {
+ for (var j = 0; j < mainGrid.gridColumns; j++) {
+ if (mainGrid.cells[i][j].isClicked) {
+ addCellLetterToWord(mainGrid.cells[i][j].letter);
+ mainGrid.cells[i][j].isClicked = false;
+ mainGrid.cells[i][j].setColorToLetter("#FFFFFF");
+ mainGrid.cells[i][j].setLetter('');
+ }
+ }
+ }
+ for (var i = 0; i < wordGrid.gridLines; i++) {
+ for (var j = 0; j < wordGrid.gridColumns; j++) {
+ if (wordGrid.cells[i][j].isClicked) {
+ //Retrait de la lettre cliquée du mot
+ wordGrid.cells[i][j].setLetter('');
+ wordGrid.cells[i][j].isClicked = false;
+ wordGrid.cells[i][j].removeCell(j);
+ //Ajout de la lettre à la grille principale
+ mainGrid.addRandomLetter(wordGrid.cells[i][j].letter);
+ }
+ }
+ }
if (LK.ticks % 60 == 0) {
//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++) {
@@ -313,18 +348,8 @@
if (mainGrid.isFull()) {
mainGrid.colorAllCells("#FF0000");
LK.showGameOver();
}
- //Recherche de la lettre cliquée et ajout de la lettre à la liste des lettres formant le mot
- for (var i = 0; i < mainGrid.gridLines; i++) {
- for (var j = 0; j < mainGrid.gridColumns; j++) {
- if (mainGrid.cells[i][j].isClicked) {
- addCellLetterToWord(mainGrid.cells[i][j].letter);
- mainGrid.cells[i][j].isClicked = false;
- mainGrid.cells[i][j].setColorToLetter("#FFFFFF");
- }
- }
- }
}
}; //Fin de la fonction update
//Liste des mots en majuscule
var wordsMainList = ["AARDVARK", "ALBATROSS", "ALLIGATOR", "ALPACA", "ANT", "ANTEATER", "ANTELOPE", "APE", "ARMADILLO", "BABOON", "BADGER", "BAT", "BEAR", "BEAVER", "BEE", "BEETLE", "BISON", "BOAR", "BUFFALO", "BUTTERFLY", "CAMEL", "CANARY", "CAPYBARA", "CARIBOU", "CARP", "CAT", "CATERPILLAR", "CHEETAH", "CHICKEN", "CHIMPANZEE", "CHINCHILLA", "CHOUGH", "CLAM", "COBRA", "COCKROACH", "COD", "CORMORANT", "COYOTE", "CRAB", "CRANE", "CROCODILE", "CROW", "CURLEW", "DEER", "DINOSAUR", "DOG", "DOGFISH", "DOLPHIN", "DONKEY", "DOTTEREL", "DOVE", "DRAGONFLY", "DUCK", "DUGONG", "DUNLIN", "EAGLE", "ECHIDNA", "EEL", "ELAND", "ELEPHANT", "ELK", "EMU", "FALCON", "FERRET", "FINCH", "FISH", "FLAMINGO", "FLY", "FOX", "FROG", "GAUR", "GAZELLE", "GERBIL", "GIRAFFE", "GNAT", "GNU", "GOAT", "GOLDFINCH", "GOLDFISH", "GOOSE", "GORILLA", "GOSHAWK", "GRASSHOPPER", "GROUSE", "GUANACO", "GULL", "HAMSTER", "HARE", "HAWK", "HEDGEHOG", "HERON", "HERRING", "HIPPOPOTAMUS", "HORNET", "HORSE", "HUMMINGBIRD", "HYENA", "IBEX", "IBIS", "JACKAL", "JAGUAR", "JAY", "JELLYFISH", "KANGAROO", "KINGFISHER", "KOALA", "KOOKABURA", "KUDU", "LAPWING", "LARK", "LEMUR", "LEOPARD", "LION", "LLAMA", "LOBSTER", "LOCUST", "LORIS", "LOUSE", "LYREBIRD", "MAGPIE", "MALLARD", "MANATEE", "MANDRILL", "MANTIS", "MARTEN", "MEERKAT", "MINK", "MOLE", "MONKEY", "MOOSE", "MOSQUITO", "MOUSE", "MULE", "NARWHAL", "NEWT", "NIGHTINGALE", "OCTOPUS", "OKAPI", "OPOSSUM", "ORYX", "OSTRICH", "OTTER", "OWL", "OYSTER", "PANTHER", "PARROT", "PARTRIDGE", "PEAFOWL", "PELICAN", "PENGUIN", "PHEASANT", "PIG", "PIGEON", "POLAR BEAR", "PORCUPINE", "PORPOISE", "QUAIL", "QUELEA", "QUETZAL", "RABBIT", "RACCOON", "RAIL", "RAM", "RAT", "RAVEN", "REINDEER", "RHINOCEROS", "ROOK", "SALAMANDER", "SALMON", "SANDPIPER", "SARDINE", "SCORPION", "SEAHORSE", "SEAL", "SHARK", "SHEEP", "SHREW", "SKUNK", "SNAIL", "SNAKE", "SPARROW", "SPIDER", "SPOONBILL", "SQUID", "SQUIRREL", "STARLING", "STINGRAY", "STINKBUG", "STORK", "SWALLOW", "SWAN", "TAPIR", "TARSIER", "TERMITE", "TIGER", "TERN", "THRUSH", "TIGER", "TOAD", "TOUCAN", "TROUT", "TURKEY", "TURTLE", "VIPER", "VULTURE", "WALLABY", "WALRUS", "WASP", "WEASEL", "WHALE", "WILDCAT", "WOLF", "WOMBAT", "WOODCOCK", "WOODPECKER", "WORM", "WREN", "YAK", "ZEBRA"];
\ No newline at end of file
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.