Code edit (15 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: wordGgrid is not defined' in or related to this line: 'var letter = clueWord[wordGgrid.gridColumns];' Line Number: 633
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: wordOfGrid is undefined' in or related to this line: 'if (notEnoughtMoneyForDrop || clueWord == '' && !wordGrid.isEmpty() || clueWord.length < wordOfGrid.length) {' Line Number: 903
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: wordGrid.words[0] is undefined' in or related to this line: 'return true;' Line Number: 267
Code edit (1 edits merged)
Please save this source code
Code edit (20 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: clueButtonLetter is not defined' in or related to this line: 'scrollCostCoins(clueButtonLetter.x, clueButtonLetter.y, 1, 10);' Line Number: 549
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: 'Timeout.tick error: options is undefined' in or related to this line: 'var imageToScrollRescale = {' Line Number: 775
Code edit (15 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: options is undefined' in or related to this line: 'var imageToScrollRescale = {' Line Number: 775
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: options is undefined' in or related to this line: 'var imageToScrollRescale = {' Line Number: 748
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: createRewardImages is not defined' in or related to this line: 'createRewardImages('RewardsCoin', tableauFrom);' Line Number: 469
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: imagesToScrollRescale[i] is undefined' in or related to this line: 'if (imagesToScrollRescale[i].isDestroyedOnEnd) {' Line Number: 725
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: backGroundOptionsZone is not defined' in or related to this line: 'game.addChild(backGroundOptionsZone);' Line Number: 351
===================================================================
--- original.js
+++ change.js
@@ -150,8 +150,21 @@
}
self.x += cell.cellSize / 2; //Repositionnement de la grille
}
}; //Fin de la fonction removeCell
+ self.cellsPositions = function () {
+ //Return the absolutes positions of the cells in the game
+ var positions = [];
+ for (var i = 0; i < self.gridLines; i++) {
+ for (var j = 0; j < self.gridColumns; j++) {
+ positions.push({
+ x: self.cells[i][j].x + self.x,
+ y: self.cells[i][j].y + self.y
+ });
+ }
+ }
+ return positions;
+ }; //Fin de la fonction cellsPositions
self.setLetter = function (column, line, letter) {
// Set a letter in the grid at (column, line)
if (column >= 0 && column < self.gridColumns && line >= 0 && line < self.gridLines) {
self.cells[line][column].setLetter(letter);
@@ -298,8 +311,9 @@
var europeanCapitales = ["AMSTERDAM", "ANDORRA-LA-VELLA", "ANKARA", "ATHENS", "BELGRADE", "BERLIN", "BERN", "BRATISLAVA", "BRUSSELS", "BUCHAREST", "BUDAPEST", "CHISINAU", "COPENHAGEN", "DUBLIN", "HELSINKI", "KIEV", "LISBON", "LJUBLJANA", "LONDON", "LUXEMBOURG", "MADRID", "MINSK", "MONACO", "MOSCOW", "NICOSIA", "OSLO", "PARIS", "PODGORICA", "PRAGUE", "REYKJAVIK", "RIGA", "ROME", "SAN-MARINO", "SARAJEVO", "SKOPJE", "SOFIA", "STOCKHOLM", "TALLINN", "TBILISI", "TIRANA", "VADUZ", "VALLETTA", "VIENNA", "VILNIUS", "WARSAW", "ZAGREB"];
//var planetesNsatellites = ["SUN", "MERCURY", "VENUS", "EARTH", "MOON", "MARS", "PHOBOS", "DEIMOS", "JUPITER", "IO", "EUROPA", "GANYMEDE", "CALLISTO", "SATURN", "TITAN", "MIMAS", "ENCELADUS", "TETHYS", "DIONE", "RHEA", "HYPERION", "LAPETUS", "PHOEBE", "URANUS", "PUCK", "MIRANDA", "ARIEL", "UMBRIEL", "TITANIA", "OBERON", "NEPTUNE", "TRITON", "PROTEUS", "NEREID", "PLUTO", "CHARON"];
var planetesNsatellites = ["SUN", "MERCURY", "VENUS", "EARTH", "MOON", "MARS"];
var scoreTest = 0; // Define scoreTest variable
+var isScoreUpdatable = false; // Autorise ou pas la mise à jour du score
var score = 0;
/****
* Game zones and backgrounds
****/
@@ -416,14 +430,24 @@
function onClickValidateButton() {
if (validateWord(mainGrid.words)) {
//On vide la grille des lettres formant le mot final apres x secondes
LK.setTimeout(function () {
- createRewardImage(wordGrid.x, wordGrid.y);
+ var tableauFrom = wordGrid.cellsPositions();
+ createRewardImages('RewardsCoin', tableauFrom);
wordGrid.resetGrid();
initWordGrid();
}, 1000);
if (mainGrid.isEmpty()) {
- score += 100; //Bonus for emptying the main grid
+ var tableauFrom = [];
+ tableauFrom.push({
+ x: mainGrid.x + mainGrid.width / 2,
+ y: mainGrid.y + mainGrid.height / 2
+ });
+ createRewardImages('RewardsCoin', tableauFrom);
+ if (imagesToScrollRescale.length > 0) {
+ imagesToScrollRescale[0].valueToAddToScore = 100; //Bonus for emptying the main grid
+ imagesToScrollRescale[0].nbTicksLeft = 30;
+ }
isMGRefillrequired = true;
}
} else {
//Le mot n'est pas valide, on remet les lettres dans la grille principale
@@ -660,9 +684,9 @@
}
if (liste.includes(word)) {
wordGrid.addWord(word); //Archive les mots trouves
mainGrid.removeWord(word); //Retire le mot de la grille principale
- score += word.length * 10;
+ //score += word.length * 10;
isWordValid = true;
} else {
isWordValid = false;
}
@@ -686,9 +710,10 @@
xToReach: 0,
yToReach: 0,
scaleToReach: 1,
nbTicksLeft: 0,
- isDestroyedOnEnd: false
+ isDestroyedOnEnd: false,
+ valueToAddToScore: 0
};
game.addChild(assetToScrollRescale);
return imageToScrollRescale;
} //fin createImageToSrollRescale
@@ -696,15 +721,28 @@
function scrollRescaleImages() {
for (var i = 0; i < imagesToScrollRescale.length; i++) {
if (imagesToScrollRescale[i].animate) {
if (imagesToScrollRescale[i].nbTicksLeft == 0) {
- //On retire l'image du tableau si le nombre de ticks est nul
- imagesToScrollRescale.splice(i, 1);
+ //On joue un son si soundOnEnd est défini
+ if (imagesToScrollRescale[i].soundOnEnd != '') {
+ LK.getSound(imagesToScrollRescale[i].soundOnEnd).play();
+ }
+ //On ajoute la valeur à ajouter au score si valueToAddToScore est défini
+ if (imagesToScrollRescale[i].valueToAddToScore != 0) {
+ score += imagesToScrollRescale[i].valueToAddToScore;
+ isScoreUpdatable = true;
+ }
//On détruit l'image si isDestroyedOnEnd est vrai
- if (imagesToScrollRescale[i] && imagesToScrollRescale[i].isDestroyedOnEnd) {
+ var imageToDestroy = null;
+ if (imagesToScrollRescale[i].isDestroyedOnEnd) {
game.removeChild(imagesToScrollRescale[i].image);
- imagesToScrollRescale[i].image.destroy();
+ imageToDestroy = imagesToScrollRescale[i].image;
}
+ //On retire l'image du tableau si le nombre de ticks est nul
+ imagesToScrollRescale.splice(i, 1);
+ if (imageToDestroy) {
+ imageToDestroy.destroy();
+ }
} else {
var x = imagesToScrollRescale[i].image.x;
var y = imagesToScrollRescale[i].image.y;
var scale = imagesToScrollRescale[i].image.scale.x;
@@ -723,28 +761,34 @@
}
}
}
} //fin scrollRescaleImages
-//Fonction createRewardImage : permet de créer une image de récompense
-//Une image de RewardsCoin est crée à la position x, y puis elle est scrollRescalée à la position du score
-function createRewardImage(x, y) {
- var rewardImage = createImageToSrollRescale('RewardsCoin', x, y);
- scoreTest = "xFrom = " + x + " / yFrom = " + y;
- rewardImage.xToReach = game.width / 2;
- rewardImage.yToReach = MainZone.y - scoreText.height / 2;
- rewardImage.scaleToReach = 1.0;
- rewardImage.nbTicksLeft = 70;
- rewardImage.animate = true;
- rewardImage.isDestroyedOnEnd = true;
- imagesToScrollRescale.push(rewardImage);
-} //fin createRewardImage
+//Fonction createRewardImages : permet de créer plusieurs images de récompense
+//Chaque image est crée à l'emplacement donnée dans le tableauFrom composé de (x, y)
+function createRewardImages(asset, tableauFrom) {
+ for (var i = 0; i < tableauFrom.length; i++) {
+ var rewardImage = createImageToSrollRescale(asset, tableauFrom[i].x, tableauFrom[i].y);
+ rewardImage.xToReach = game.width / 2;
+ rewardImage.yToReach = MainZone.y - scoreText.height / 2;
+ rewardImage.scaleToReach = 1.0;
+ rewardImage.nbTicksLeft = Math.floor(Math.random() * 30) + 40;
+ rewardImage.animate = true;
+ rewardImage.isDestroyedOnEnd = true;
+ rewardImage.soundOnEnd = 'Blip';
+ rewardImage.valueToAddToScore = 10;
+ imagesToScrollRescale.push(rewardImage);
+ }
+} //fin createRewardImages
/****
* Main loop
****/
game.update = function () {
//Mise à jour score
updateScoreTest(scoreTest);
- updateScore(score);
+ if (isScoreUpdatable) {
+ updateScore(score);
+ isScoreUpdatable = false;
+ }
//Animation des images
scrollRescaleImages();
//Recherche de la lettre cliquée dans la mainGrid et ajout de la lettre à la liste des lettres formant le mot
for (var i = 0; i < mainGrid.gridLines; i++) {
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.