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
@@ -191,9 +191,9 @@
}
}
var nbManches = 2; //nombre de manches
var nbManchesRestantes = nbManches; //nombre de manches restantes
-var nbRochers = 10; //nombre de rochers
+var nbRochers = 2; //nombre de rochers
var nbRochersRestants = nbRochers; //nombre de rochers restants
var nbBuldoRocks = 0; //nombre de buldoRocks
var nbBuldoZers = 0; //nombre de buldoZers
var delta = 1; //Heritage des tests en PixiJS
@@ -224,8 +224,9 @@
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 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
var typeLigneVtoY = 3; //Type 3 = déplacement vertical vers une position Y
@@ -820,9 +821,9 @@
function updateScoreOrdi(nouveauScore) {
scoreOrdiText.setText(nouveauScore);
} //fin updateScoreOrdi
function updateScoreTest(nouveauScore) {
- scoreFictifText.setText(nouveauScore);
+ scoreTestText.setText(nouveauScore);
} //fin updateScoreTest
//Creation de l'objet coupe de la victoire a partir de l'image coupeVictoire entre les deux scores
var victoireX = game.width / 2;
var victoireY = ScoreZone.height / 2;
@@ -833,8 +834,17 @@
scaleY: 4,
x: victoireX,
y: victoireY
});
+//Creation d'un objet imageCoupeVictoire a partir de l'image coupeVictoire avec un point (x,y) de destination
+var imageCoupeVictoire = {
+ animate: false,
+ image: coupeVictoire,
+ xToReach: 0,
+ yToReach: 0,
+ 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;
@@ -859,8 +869,36 @@
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
+ for (var i = 0; i < imagesToScrollRescale.length; i++) {
+ if (imagesToScrollRescale[i].animate) {
+ if (imagesToScrollRescale[i].nbTicksLeft == 0) {
+ imagesToScrollRescale[i].animate = false;
+ } else {
+ var x = imagesToScrollRescale[i].image.x;
+ var y = imagesToScrollRescale[i].image.y;
+ var scale = imagesToScrollRescale[i].image.scale.x;
+ var xToReach = imagesToScrollRescale[i].xToReach;
+ var yToReach = imagesToScrollRescale[i].yToReach;
+ var scaleToReach = imagesToScrollRescale[i].scaleToReach;
+ var nbTicksLeft = imagesToScrollRescale[i].nbTicksLeft;
+ var dx = (xToReach - x) / nbTicksLeft;
+ var dy = (yToReach - y) / nbTicksLeft;
+ var dscale = (scaleToReach - scale) / nbTicksLeft;
+ imagesToScrollRescale[i].image.x += dx;
+ imagesToScrollRescale[i].image.y += dy;
+ imagesToScrollRescale[i].image.scale.x += dscale;
+ imagesToScrollRescale[i].image.scale.y += dscale;
+ imagesToScrollRescale[i].nbTicksLeft -= 1;
+ }
+ }
+ }
+} //fin scrollRescaleImages
function createSingleRandomRock(size) {
//Creation d'un rocher de taille donnee a ajouter a la liste des rochers
//L'ordonnee est choisie aleatoirement dans la zone de route disponible (ordonneesRestantes)
if (ordonneesRestantes.length == 0) {
@@ -1010,15 +1048,15 @@
// Positionnement du score du camp ordinateur dans la zone score au depart de la zone ordi
LK.gui.top.addChild(scoreOrdiText); //Point de reference (game.width/2,0)
scoreOrdiText.x += ComputerZone.width / 2; //Puis decalage a droite
// Positionnement au top centre d'un score fictif pour tests
-var scoreFictifText = new Text2('0', {
+var scoreTestText = new Text2('0', {
size: 70,
fill: "#00ff00",
anchorX: 0.5,
anchorY: 0
});
-//LK.gui.top.addChild(scoreFictifText);
+//LK.gui.top.addChild(scoreTestText);
// Instead of directly calling checkMovesStack, iterate over buldos and call checkMovesStack for each --> already doing this
LK.on('tick', function () {
//Lancement du jeu : choix des rochers a pousser pour l'ordinateur
//Si le camp actif est selectionne (-1, 1), mais que la partie n'a pas encore commence (gameHasStarted = false):
@@ -1159,20 +1197,29 @@
//Mise à jour des scores
updateScoreHumain(scoreHumain);
updateScoreOrdi(scoreOrdi);
//updateScoreTest(scoreTest);
- //Animation de l'image victoire
+ //Animation des images dont victoire
if (animateImage) {
nbTicksLeft = scrollRescaleImage(coupeVictoire, 1, game.width / 2, game.height / 2, nbTicksLeft);
}
+ scrollRescaleImages();
//Fin de partie
- if (nbRochersRestants <= 7) {
- nbManchesRestantes -= 1;
+ if (nbRochersRestants <= 0) {
if (scoreHumain >= scoreOrdi) {
afficheVictoire(humanCamp);
+ imageCoupeVictoire.xToReach = game.width / 2 - nbManchesRestantes * game.width / 8;
+ imageCoupeVictoire.yToReach = ScoreZone.y;
+ imageCoupeVictoire.nbTicksLeft = 60;
+ imageCoupeVictoire.animate = true;
+ imagesToScrollRescale.push(imageCoupeVictoire);
} else {
afficheVictoire(ordiCamp);
- animateImage = true;
+ imageCoupeVictoire.xToReach = game.width / 2 + nbManchesRestantes * game.width / 8;
+ imageCoupeVictoire.yToReach = ScoreZone.y;
+ imageCoupeVictoire.nbTicksLeft = 50;
+ imageCoupeVictoire.animate = true;
+ imagesToScrollRescale.push(imageCoupeVictoire);
}
//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) {
@@ -1182,8 +1229,9 @@
}
});
}
if (allBack) {
+ nbManchesRestantes -= 1;
if (nbManchesRestantes > 0) {
rochers = generateRandomRock(nbRochers);
nbRochersRestants = nbRochers;
activeCamp = 0;
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.