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
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 (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self.texte.letter is undefined' in or related to this line: 'self.texte.letter.fill = color;' Line Number: 71
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 (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: emptyCells is not defined' in or related to this line: 'if (emptyCells.includes(self.cells[i][j])) {' Line Number: 128
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
Initial prompt
Cool Words
===================================================================
--- original.js
+++ change.js
@@ -48,26 +48,27 @@
var text = new Text2(letter.toUpperCase(), {
size: 128,
fill: "#ffffff"
});
- text.anchor.set(0.5, 0.5);
- self.addChild(text);
+ self.texte = text;
+ self.texte.anchor.set(0.5, 0.5);
+ self.addChild(self.texte);
self.column = 0;
self.line = 0;
self.setLetter = function (newLetter) {
self.letter = newLetter;
- text.setText(newLetter.toUpperCase());
- text.x = -10;
- text.y = -10;
+ self.texte.setText(newLetter.toUpperCase());
+ self.texte.x = -10;
+ self.texte.y = -10;
};
self.setColorToLetter = function (color) {
- text.fill = color;
+ self.texte.fill = color;
};
self.onClickCell = function () {
//Fonction appelée lors du click sur la cellule
- self.text.fill = "#0000FF";
self.isClicked = true;
- scoreTest += 1;
+ self.setColorToLetter("#FF0000");
+ scoreTest = self.letter;
};
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
@@ -118,10 +119,10 @@
var added = false;
if (self.emptyCells.length > 0) {
var randomIndex = Math.floor(Math.random() * self.emptyCells.length);
var cell = self.emptyCells[randomIndex];
+ cell.texte.fill = "#00FF00";
cell.setLetter(letter);
- cell.setColorToLetter("#00FF00");
added = true;
//Retrait de la cellule de la liste des cellules vides
if (self.emptyCells.includes(cell)) {
self.emptyCells.splice(self.emptyCells.indexOf(cell), 1);
@@ -173,12 +174,12 @@
var lettersGrid = game.addChild(new LettersGrid(3, 1));
lettersGrid.initializeGrid();
lettersGrid.x = (2048 - lettersGrid.gridColumns * lettersGrid.cellSize) / 2;
lettersGrid.y = 200;
-var wordGrid = game.addChild(new LettersGrid(6, 6));
-wordGrid.initializeGrid();
-wordGrid.x = (2048 - wordGrid.gridColumns * wordGrid.cellSize) / 2;
-wordGrid.y = 600;
+var mainGrid = game.addChild(new LettersGrid(6, 6));
+mainGrid.initializeGrid();
+mainGrid.x = (2048 - mainGrid.gridColumns * mainGrid.cellSize) / 2;
+mainGrid.y = 600;
var lettersToAdd = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
var currentLetterIndex = 0;
var ScoreZone = {
x: 0,
@@ -193,9 +194,9 @@
height: 200
};
var scoreTestText = new Text2('0', {
size: 70,
- fill: "#00ff00",
+ fill: "#ffff00",
anchorX: 0.5,
anchorY: 0
});
LK.gui.top.addChild(scoreTestText);
@@ -248,22 +249,28 @@
letters.push(word[Math.floor(Math.random() * word.length)]);
}
return letters;
} //Fin de la fonction pickLettersFromWord
+//Fonction stackLettersToAdd : permet de stocker les lettres dans la liste lettersToAdd
+function stackLettersToAdd(letters) {
+ for (var i = 0; i < letters.length; i++) {
+ lettersToAdd.push(letters[i]);
+ }
+} //Fin de la fonction stackLettersToAdd
game.update = function () {
+ updateScoreTest(scoreTest);
if (LK.ticks % 60 == 0) {
// Add a letter every second
- var added = wordGrid.addRandomLetter(lettersToAdd[currentLetterIndex]);
+ var added = mainGrid.addRandomLetter(lettersToAdd[currentLetterIndex]);
if (!added) {
//LK.showGameOver();
return;
}
currentLetterIndex = (currentLetterIndex + 1) % lettersToAdd.length;
- if (wordGrid.isFull()) {
- wordGrid.colorAllCells("#FF0000");
+ if (mainGrid.isFull()) {
+ mainGrid.colorAllCells("#FF0000");
LK.showGameOver();
}
- updateScoreTest(scoreTest);
}
}; //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.