===================================================================
--- original.js
+++ change.js
@@ -1,95 +1,130 @@
-/****
+/****
* Classes
-****/
+****/
+/****
+* GAME DESCRIPTION:
+* Game Principle:
+ * -There is a board filled with words, where the player selects letters from a partially filled grid.
+ * -With these letters, the player forms a word that appears below the grid, then validates their word.
+ * -If the word is among the words on the board, it is valid, and the player earns points.
+ * -The score obtained is proportional to the length of the word.
+ * -Above the grid, there are letters randomly taken from the word board.
+ * -These letters move randomly within the grid to empty spaces.
+ * -New letters are placed above the grid.
+ * -If the word is not valid, the letters forming the word are returned to their original position in the grid.
+ * -The letters above the grid move randomly within the grid to empty spaces.
+ * -If there is no more space in the grid, the game is over.
+* Game Areas:
+ * The screen is divided into 6 main zones in the following descending order:
+ 1. Score area: displays the player's score.
+ 2. Next letters area: displays the letters that will fall into the grid.
+ 3. The grid: the letter grid.
+ 4. Word area: displays the word formed by the player.
+ 5. Validation area: button to validate the word or erase letters.
+ 6. Options area (or advertisement).
+* Game Progression:
+ * At the start of the game, the grid is almost full, containing 5 letters.
+ * 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.
+ * 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.
+ * The letters located above the grid move randomly within the grid to empty spaces.
+ * 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 self = Container.call(this);
- var cellGraphics = self.attachAsset('cell', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.letter = letter;
- var text = new Text2(letter.toUpperCase(), {
- size: 64,
- fill: "#ffffff"
- });
- text.anchor.set(0.5, 0.5);
- self.addChild(text);
- self.setLetter = function (newLetter) {
- self.letter = newLetter;
- text.setText(newLetter.toUpperCase());
- };
+ var self = Container.call(this);
+ var cellGraphics = self.attachAsset('cell', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.letter = letter;
+ var text = new Text2(letter.toUpperCase(), {
+ size: 64,
+ fill: "#ffffff"
+ });
+ text.anchor.set(0.5, 0.5);
+ self.addChild(text);
+ self.setLetter = function (newLetter) {
+ self.letter = newLetter;
+ text.setText(newLetter.toUpperCase());
+ };
});
// 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.cells = [];
- self.initializeGrid = function () {
- for (var i = 0; i < self.gridSize; i++) {
- self.cells[i] = [];
- for (var j = 0; j < self.gridSize; 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.gridSize && !added; i++) {
- for (var j = 0; j < self.gridSize && !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.gridSize; i++) {
- for (var j = 0; j < self.gridSize; j++) {
- if (self.cells[i][j].letter === '') {
- return false;
- }
- }
- }
- return true;
- };
+ var self = Container.call(this);
+ self.gridSize = 5; // 5x5 grid
+ self.cellSize = 2048 / self.gridSize;
+ self.cells = [];
+ self.initializeGrid = function () {
+ for (var i = 0; i < self.gridSize; i++) {
+ self.cells[i] = [];
+ for (var j = 0; j < self.gridSize; 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.gridSize && !added; i++) {
+ for (var j = 0; j < self.gridSize && !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.gridSize; i++) {
+ for (var j = 0; j < self.gridSize; j++) {
+ if (self.cells[i][j].letter === '') {
+ return false;
+ }
+ }
+ }
+ return true;
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 // Init game with black background
+ backgroundColor: 0x000000 // Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
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 currentLetterIndex = 0;
game.update = function () {
- if (LK.ticks % 60 == 0) {
- // Add a letter every second
- var added = wordGrid.addLetter(lettersToAdd[currentLetterIndex]);
- if (!added) {
- LK.showGameOver();
- return;
- }
- currentLetterIndex = (currentLetterIndex + 1) % lettersToAdd.length;
- if (wordGrid.isFull()) {
- LK.showGameOver();
- }
- }
+ if (LK.ticks % 60 == 0) {
+ // Add a letter every second
+ var added = wordGrid.addLetter(lettersToAdd[currentLetterIndex]);
+ if (!added) {
+ LK.showGameOver();
+ return;
+ }
+ currentLetterIndex = (currentLetterIndex + 1) % lettersToAdd.length;
+ if (wordGrid.isFull()) {
+ LK.showGameOver();
+ }
+ }
};
\ 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.