===================================================================
--- original.js
+++ change.js
@@ -27,9 +27,9 @@
* Above the grid, there are 4 letters randomly taken from the word board.
* 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 they have formed a word, they can validate it with the validate button located below the word area.
+ * 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.
* The letters located above the grid move randomly within the grid to empty spaces.
* New letters are added above the grid.
* If the word is not valid, the letters forming the word are returned to their original position in the grid.
@@ -45,9 +45,9 @@
anchorY: 0.5
});
self.letter = letter;
var text = new Text2(letter.toUpperCase(), {
- size: 64,
+ size: 96,
fill: "#ffffff"
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
@@ -55,13 +55,56 @@
self.letter = newLetter;
text.setText(newLetter.toUpperCase());
};
});
+// 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 self = Container.call(this);
+ // Number of columns and lines
+ self.gridColumns = columns;
+ self.gridLines = lines;
+ self.cellSize = 1280 / self.gridColumns;
+ self.cells = [];
+ 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('');
+ cell.x = j * self.cellSize + self.cellSize / 2;
+ cell.y = i * self.cellSize + self.cellSize / 2;
+ self.addChild(cell);
+ self.cells[i][j] = cell;
+ }
+ }
+ };
+ 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++) {
+ if (self.cells[i][j].letter === '') {
+ self.cells[i][j].setLetter(letter);
+ added = true;
+ }
+ }
+ }
+ return added;
+ };
+ self.isFull = 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;
+ };
+});
// WordGrid class for managing the grid of letters
var WordGrid = Container.expand(function () {
var self = Container.call(this);
- self.gridSize = 5; // 5x5 grid
- self.cellSize = 2048 / self.gridSize;
+ self.gridSize = 6; // 5x5 grid
+ self.cellSize = 1280 / self.gridSize;
self.cells = [];
self.initializeGrid = function () {
for (var i = 0; i < self.gridSize; i++) {
self.cells[i] = [];
@@ -100,20 +143,25 @@
/****
* Initialize Game
****/
+//Fin de la classe LettersGrid
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
+var lettersGrid = game.addChild(new LettersGrid(6, 1));
+lettersGrid.initializeGrid();
+lettersGrid.x = (2048 - lettersGrid.gridColumns * lettersGrid.cellSize) / 2;
+lettersGrid.y = 200;
var wordGrid = game.addChild(new WordGrid());
wordGrid.initializeGrid();
wordGrid.x = (2048 - wordGrid.gridSize * wordGrid.cellSize) / 2;
wordGrid.y = (2732 - wordGrid.gridSize * wordGrid.cellSize) / 2;
-var lettersToAdd = ['A', 'B', 'C', 'D', 'E']; // Example letters to add
+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;
game.update = function () {
if (LK.ticks % 60 == 0) {
// Add a letter every second
@@ -126,5 +174,19 @@
if (wordGrid.isFull()) {
LK.showGameOver();
}
}
-};
\ No newline at end of file
+};
+var ScoreZone = {
+ x: 0,
+ y: 0,
+ width: game.width,
+ height: 200
+};
+var OptionsZone = {
+ x: 0,
+ y: game.height - 200,
+ width: game.width,
+ height: 200
+};
+//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.