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
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
@@ -43,8 +43,9 @@
var cellGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
+ self.cellSize = cellGraphics.width;
self.clickable = true; //Indique si la cellule est cliquable
self.letter = letter;
self.policeSize = policeSize;
var text = new Text2(letter.toUpperCase(), {
@@ -81,19 +82,19 @@
var LettersGrid = Container.expand(function (columns, lines, assetName) {
var self = Container.call(this);
self.gridColumns = columns;
self.gridLines = lines;
- self.cellSize = 300;
+ //self.cellSize = 200;
self.clickable = true; //Indique si la grille est cliquable
self.cells = [];
self.emptyCells = []; //Liste des cellules vides
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('', assetName);
- cell.x = j * self.cellSize + self.cellSize / 2;
- cell.y = i * self.cellSize + self.cellSize / 2;
+ cell.x = j * cell.cellSize;
+ cell.y = i * cell.cellSize + cell.cellSize / 2;
self.addChild(cell);
self.cells[i][j] = cell;
cell.column = j;
cell.line = i;
@@ -110,10 +111,10 @@
//Only when there is only one gridLine, add a cell to the grid with the given letter
var cell = null;
if (self.gridLines === 1) {
cell = new GridCell(letter, assetName);
- cell.x = self.gridColumns * self.cellSize + self.cellSize / 2;
- cell.y = self.cellSize / 2;
+ cell.x = self.gridColumns * cell.cellSize;
+ cell.y = cell.cellSize / 2;
self.addChild(cell);
self.cells[0][self.gridColumns] = cell;
cell.column = self.gridColumns;
cell.line = 0;
@@ -232,18 +233,18 @@
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.x = (game.width - lettersGrid.width) / 2;
lettersGrid.y = ScoreZone.height + lettersGrid.height / 2;
var mainGrid = game.addChild(new LettersGrid(6, 6, 'cell'));
mainGrid.initializeGrid();
-mainGrid.x = (game.width - mainGrid.gridColumns * mainGrid.cellSize) / 2;
+mainGrid.x = (game.width - mainGrid.width) / 2;
mainGrid.y = ScoreZone.height + 2 * lettersGrid.height;
-var wordGrid = game.addChild(new LettersGrid(2, 1, 'cell'));
+var wordGrid = game.addChild(new LettersGrid(1, 1, 'cell'));
wordGrid.initializeGrid();
-wordGrid.x = (game.width - wordGrid.gridColumns * wordGrid.cellSize) / 2;
-wordGrid.y = ScoreZone.height + lettersGrid.height + mainGrid.height;
+wordGrid.x = (game.width - wordGrid.width) / 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
if (wordsToBegin.length > 0) {
@@ -292,28 +293,12 @@
mainGrid.addRandomLetter(lettersToAdd[0]);
lettersToAdd.splice(0, 1);
}
} //Fin de la fonction transfertLettersToMainGrid
-//Fonction addCellLetterToWord : permet d'ajouter une cellule à la liste des lettres formant le mot sous la grille
-function addCellLetterToWord(cell) {
- var cellSize = 128;
- var cellLetter = new GridCell(cell.letter, 'cellWord');
- cellLetter.x = game.width / 2 + cellSize * (word.length / 2);
- cellLetter.y = ScoreZone.height + 3 * lettersGrid.height + cellSize / 2;
- cellLetter.policeSize = 70;
- cellLetter.texte.setStyle({
- size: cellLetter.policeSize
- });
- cellLetter.on('down', function () {
- //Fonction appelée lors du click sur la cellule
- if (cellLetter.isClicked) {
- cellLetter.isClicked = false;
- cellLetter.setColorToLetter("#ffffff");
- word.splice(word.indexOf(cellLetter.letter), 1);
- }
- });
- word.push(cellLetter.letter);
- game.addChild(cellLetter);
+//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');
+ wordGrid.addCell(letter, 'cell');
} //Fin de la fonction addCellLetterToWord
game.update = function () {
updateScoreTest(scoreTest);
if (LK.ticks % 60 == 0) {
@@ -328,8 +313,18 @@
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.