Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: game.playSound is not a function' in or related to this line: 'game.playSound(rock_appears);' Line Number: 959
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'rocher.sprite = self.rocher_split_sprite;' Line Number: 1160
Code edit (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: rocher_split_sprite is not defined' in or related to this line: 'rocher.sprite = rocher_split_sprite;' Line Number: 1159
Code edit (1 edits merged)
Please save this source code
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: animatinImageOn is not defined' in or related to this line: 'if (!animatinImageOn) {' Line Number: 1221
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: coupeVictoire is not defined' in or related to this line: 'var imageCoupeVictoire = {' Line Number: 856
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: Score is not defined' in or related to this line: 'imageCoupeVictoire.yToReach = Score;' Line Number: 1236
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: nbTicksLeft is not defined' in or related to this line: 'nbTicksLeft = scrollRescaleImage(coupeVictoire, 1, game.width / 2, game.height / 2, nbTicksLeft);' Line Number: 1182
Code edit (1 edits merged)
Please save this source code
Code edit (22 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: victoireX is not defined' in or related to this line: 'var coupeVictoire = LK.getAsset('coupeVictoire', {' Line Number: 842
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: rocher_petit_sprite is not defined' in or related to this line: 'self.sprite = rocher_petit_sprite;' Line Number: 327
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: rocher_moyen_sprite is not defined' in or related to this line: 'self.sprite = rocher_moyen_sprite;' Line Number: 330
Code edit (11 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -223,9 +223,9 @@
var grosRocherDxHotRight = 45 * 2; //hotspot X du sprite grosRocher, offset du sprite par rapport à l'ancrage
var grosRocherDyHotRight = 0; //hotspot Y du sprite grosRocher
var timeBeforeSplit = 200; //temps en ticks avant division du rocher bloque
var nbTicksBeforeStopFlashing = 10; //nombre de ticks avant d'arreter de clignoter
-var animateImage = false; //Drapeau indiquant qu'une image est a scrollscaller
+var animatingImageOn = false; //Drapeau indiquant qu'une image est a scrollscaller
var imagesToScrollRescale = []; //Liste des images a scrollscaller
var nbTicksLeft = 20; //Nb ticks pour deplacer une image
var typeRotation = 1; //Type 1 = rotation
var typeLigneHtoX = 2; //Type 2 = déplacement horizontal vers une position X
@@ -834,10 +834,8 @@
} //fin updateScoreOrdi
function updateScoreTest(nouveauScore) {
scoreTestText.setText(nouveauScore);
} //fin updateScoreTest
-//Creation d'un objet imageCoupeVictoire a partir de l'image coupeVictoire avec un point (x,y) de destination
-// Removed the direct reference to coupeVictoire in imageCoupeVictoire object to avoid ReferenceError
var imageCoupeVictoire = {
animate: false,
image: null,
// Temporarily set to null, will be assigned a valid coupeVictoire asset later in the code
@@ -846,11 +844,9 @@
scaleToReach: 1,
nbTicksLeft: 0
};
// Fonction pour afficher la victoire d'une equipe en fonction de sa couleur
-function afficheVictoire(camp) {
- var victoireX = camp == humanCamp ? game.width / 5 : game.width - game.width / 3;
- var victoireY = ScoreZone.height;
+function afficheVictoire(camp, victoireX, victoireY) {
// Création d'une nouvelle instance de coupeVictoire à chaque appel de la fonction
var coupeVictoire = LK.getAsset('coupeVictoire', {
anchorX: 0.5,
anchorY: 0,
@@ -858,31 +854,19 @@
scaleY: 4,
x: victoireX,
y: victoireY
});
+ var imageCoupeVictoire = {
+ animate: false,
+ image: coupeVictoire,
+ xToReach: 0,
+ yToReach: 0,
+ scaleToReach: 1,
+ nbTicksLeft: 0
+ };
game.addChild(coupeVictoire);
- return coupeVictoire;
+ return imageCoupeVictoire;
} //fin afficheVictoire
-function scrollRescaleImage(imageToScroll, scaleToReach, xToReach, yToReach, nbTicksLeft) {
- //Fonction de deplacement du point d'ancrage d'une image tout en la redimensionnant
- //Le nbTicksLeft est le nombre de ticks restants pour atteindre la position et la taille finales
- //A la fin du nombre de ticks, l'image doit etre redimensionnee et positionnee correctement
- if (nbTicksLeft == 0) {
- animateImage = false;
- return 0;
- }
- var x = imageToScroll.x;
- var y = imageToScroll.y;
- var scale = imageToScroll.scale.x;
- var dx = (xToReach - x) / nbTicksLeft;
- var dy = (yToReach - y) / nbTicksLeft;
- var dscale = (scaleToReach - scale) / nbTicksLeft;
- imageToScroll.x += dx;
- imageToScroll.y += dy;
- imageToScroll.scale.x += dscale;
- imageToScroll.scale.y += dscale;
- return nbTicksLeft - 1;
-} //fin scrollRescaleImage
function scrollRescaleImages() {
//Meme objectif que scrollRescaleImage utilisée pour une image unique
//mais pour plusieurs images situees dans le tableau imagesToScrollRescale sans utiliser la fonction scrollRescaleImage
//Seule les image dont le drapeau animate est a true sont animees
@@ -890,8 +874,9 @@
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);
+ animatingImageOn = false;
} else {
var x = imagesToScrollRescale[i].image.x;
var y = imagesToScrollRescale[i].image.y;
var scale = imagesToScrollRescale[i].image.scale.x;
@@ -1211,29 +1196,31 @@
updateScoreHumain(scoreHumain);
updateScoreOrdi(scoreOrdi);
//updateScoreTest(scoreTest);
//Animation des images dont victoire
- //if (animateImage) {
- // nbTicksLeft = scrollRescaleImage(coupeVictoire, 1, game.width / 2, game.height / 2, nbTicksLeft);
scrollRescaleImages();
//Fin de partie
if (nbRochersRestants <= 0) {
if (scoreHumain >= scoreOrdi) {
- var coupeVictoire = afficheVictoire(humanCamp);
- imageCoupeVictoire.image = coupeVictoire;
- imageCoupeVictoire.xToReach = game.width / 2 - nbManchesRestantes * game.width / 8;
- imageCoupeVictoire.yToReach = ScoreZone.y;
- imageCoupeVictoire.nbTicksLeft = 60;
- imageCoupeVictoire.animate = true;
- imagesToScrollRescale.push(imageCoupeVictoire);
+ if (!animatingImageOn) {
+ var imageCoupeVictoire = afficheVictoire(humanCamp, game.width / 2, game.height / 2);
+ imageCoupeVictoire.xToReach = game.width / 2 - nbManchesRestantes * game.width / 8;
+ imageCoupeVictoire.yToReach = ScoreZone.y;
+ imageCoupeVictoire.nbTicksLeft = 60;
+ imageCoupeVictoire.animate = true;
+ imagesToScrollRescale.push(imageCoupeVictoire);
+ animatingImageOn = true;
+ }
} else {
- var coupeVictoire = afficheVictoire(ordiCamp);
- imageCoupeVictoire.image = coupeVictoire;
- imageCoupeVictoire.xToReach = game.width / 2 + nbManchesRestantes * game.width / 8;
- imageCoupeVictoire.yToReach = ScoreZone.y;
- imageCoupeVictoire.nbTicksLeft = 50;
- imageCoupeVictoire.animate = true;
- imagesToScrollRescale.push(imageCoupeVictoire);
+ if (!animatinImageOn) {
+ var imageCoupeVictoire = afficheVictoire(ordiCamp);
+ imageCoupeVictoire.xToReach = game.width / 2 + nbManchesRestantes * game.width / 8;
+ imageCoupeVictoire.yToReach = ScoreZone.y;
+ imageCoupeVictoire.nbTicksLeft = 50;
+ imageCoupeVictoire.animate = true;
+ imagesToScrollRescale.push(imageCoupeVictoire);
+ animatingImageOn = true;
+ }
}
//On attend que tous les Buldos soient revenus a leur position de base pour afficher le message de fin de partie
var allBack = true;
if (buldos) {
A small rock
a rock without any shadow and four time smaller than the original.
Blue color
a rock is being crunched so there is smoke and peaces of rocks viewed from top.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Un trophée de victoire sous forme d'une coupe d'où s'échappe un feu d'artifice.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Red bulldozer viewed strictly from top. Top view as if we are a drone.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Remove yellow lines.