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
@@ -68,9 +68,8 @@
self.onClickCell = function () {
//Fonction appelée lors du click sur la cellule
self.isClicked = true;
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
@@ -198,78 +197,62 @@
var mainGrid = game.addChild(new LettersGrid(6, 6));
mainGrid.initializeGrid();
mainGrid.x = (game.width - mainGrid.gridColumns * mainGrid.cellSize) / 2;
mainGrid.y = ScoreZone.height + 2 * lettersGrid.height;
-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 lettersToAdd = [];
var currentLetterIndex = 0;
+var words = pickAndShakeWords(1);
+stackLettersFromWords(words);
/****
* Functions
****/
function updateScoreTest(nouveauScore) {
scoreTestText.setText(nouveauScore);
} //fin updateScoreTest
//Fonction pickAndShakeSingleWord : permet de choisir un mot dans la liste des mots et de le mélanger
function pickAndShakeSingleWord() {
- var randomIndex = Math.floor(Math.random() * wordsMainList.length);
- var word = wordsMainList[randomIndex];
- var wordShuffled = word.split('').sort(function () {
- return 0.5 - Math.random();
- }).join('');
- return {
- word: word,
- shuffled: wordShuffled
- };
+ //var randomIndex = Math.floor(Math.random() * wordsMainList.length);
+ //var word = wordsMainList[randomIndex];
+ scoreTest = word.length;
+ var wordShuffled = "";
+ //wordShuffled = word.split('').sort(function () {
+ // return 0.5 - Math.random();
+ //}).join('');
+ return wordShuffled;
} //Fin de la fonction pickAndShakeSingleWord
//Fonction pickAndShakeWords : permet de choisir plusieurs mots dans la liste des mots et de les mélanger
function pickAndShakeWords(numberOfWords) {
var words = [];
for (var i = 0; i < numberOfWords; i++) {
- words.push(pickAndShakeSingleWord());
+ var shuffledWord = pickAndShakeSingleWord();
+ if (shuffledWord.length > 0) {
+ words.push(shuffledWord);
+ }
}
return words;
} //Fin de la fonction pickAndShakeWords
-//Fonction displayWords : permet d'afficher les mots choisis et mélangés
-function displayWords(words) {
- var wordsContainer = new Container();
- wordsContainer.x = 0;
- wordsContainer.y = 200;
- var wordsTexts = [];
- for (var i = 0; i < words.length; i++) {
- var wordText = new Text2(words[i].shuffled, {
- size: 48,
- fill: "#ffffff"
- });
- wordText.x = 0;
- wordText.y = i * 100;
- wordsContainer.addChild(wordText);
- wordsTexts.push(wordText);
- }
- game.addChild(wordsContainer);
- return wordsTexts;
-} //Fin de la fonction displayWords
//Fonction pickLettersFromWord : permet de choisir des lettres dans un mot
function pickLettersFromWord(word, numberOfLetters) {
var letters = [];
for (var i = 0; i < numberOfLetters; i++) {
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]);
+//Fonction stackLettersToAddFromWord : permet de stocker les lettres d'un mot dans la liste lettersToAdd
+function stackLettersToAddFromWord(word) {
+ stackLettersToAdd(word.split(''));
+} //Fin de la fonction stackLettersToAddFromWord
+//Fonction stackLettersFromWords : permet de stocker les lettres de plusieurs mots dans la liste lettersToAdd
+function stackLettersFromWords(words) {
+ for (var i = 0; i < words.length; i++) {
+ stackLettersToAddFromWord(words[i].word);
}
-} //Fin de la fonction stackLettersToAdd
+} //Fin de la fonction stackLettersFromWords
game.update = function () {
updateScoreTest(scoreTest);
if (LK.ticks % 60 == 0) {
// Add a letter every second
- var added = mainGrid.addRandomLetter(lettersToAdd[currentLetterIndex]);
- if (!added) {
- //LK.showGameOver();
- return;
- }
currentLetterIndex = (currentLetterIndex + 1) % lettersToAdd.length;
if (mainGrid.isFull()) {
mainGrid.colorAllCells("#FF0000");
LK.showGameOver();
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.