Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: rochers is not defined' in or related to this line: 'for (var i = 0; i < rochers.length; i++) {' Line Number: 956
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: scoreZone is not defined' in or related to this line: 'victoireText.y = scoreZone.height;' Line Number: 798
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.getText is not a function' in or related to this line: 'var victoireText = game.addChild(LK.getText('Victoire', {' Line Number: 792
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 (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: OrdiZone is not defined' in or related to this line: 'scoreOrdiText.x = OrdiZone.x + HumanZone.width / 2;' Line Number: 933
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 TypeError: LK.Text2 is not a constructor' in or related to this line: 'var scoreHumainText = new LK.Text2('Score Humain: 0', {' Line Number: 912
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: updateScoreHumainText is not defined' in or related to this line: 'updateScoreHumainText.text = mettreAJourScore(scoreHumain);' Line Number: 960
User prompt
Please fix the bug: 'Uncaught TypeError: LK.Text2 is not a constructor' in or related to this line: 'var scoreOrdiText = new LK.Text2('Score Ordi: 0', {' Line Number: 919
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: LK.Text2 is not a constructor' in or related to this line: 'var scoreHumainText = new LK.Text2('Score Humain: 0', {' Line Number: 911
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'pushedByOrdi')' in or related to this line: 'if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {' Line Number: 655
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'pushedByOrdi')' in or related to this line: 'if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {' Line Number: 655
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'pushedByHuman')' in or related to this line: 'if (this.rocherPushed.pushedByHuman == null && this.rocherPushed.pushedByOrdi == null) {' Line Number: 641
===================================================================
--- original.js
+++ change.js
@@ -362,8 +362,9 @@
this.pushedByOrdi = null;
}
//On recupere l'ordonnee du rocher pour une potentielle reutilisation
ordonneesRestantes.push(this.sprite.y);
+ nbRochers = nbRochers - 1; //Decrement du nombre de rochers
//Invisibilite du sprite rocher
this.sprite.visible = false;
}; //fin destroy
this.onOutRocher = function () {
@@ -771,8 +772,19 @@
// Fonction pour mettre à jour le score du camp ordinateur
function updateScoreOrdi(nouveauScore) {
scoreOrdiText.setText(nouveauScore);
} //fin updateScoreOrdi
+// Fonction pour afficher la victoire d'une equipe en fonction de sa couleur
+function afficheVictoire(camp) {
+ var victoireText = game.addChild(new Text2('Victoire', {
+ x: game.width / 2,
+ y: game.height / 2,
+ fontSize: 50,
+ fontFamily: 'Arial',
+ fill: camp == humanCamp ? 'blue' : 'red',
+ align: 'center'
+ }));
+} //fin afficheVictoire
function generateRandomRock(nombreRochers) {
//Calcul de positions aléatoire pour les rochers dans la zone de route
var zoneMiniy = RoadZone.y;
var zoneMaxiy = RoadZone.y + RoadZone.height;
@@ -901,20 +913,20 @@
anchorX: 0.5,
anchorY: 0
});
// Positionnement du score du camp humain dans la zone score au depart de la zone humaine
-LK.gui.topLeft.addChild(scoreHumainText); //Point de depart (0,0)
-scoreHumainText.x += HumanZone.width / 2; //puis decalage vers la droite
+LK.gui.top.addChild(scoreHumainText); //Point de depart (game.width/2,0)
+scoreHumainText.x -= HumanZone.width / 2; //puis decalage vers la gauche
// Création de l'objet de texte pour le score du camp ordinateur
var scoreOrdiText = new Text2('0', {
size: 70,
fill: "#ff0000",
anchorX: 0.5,
anchorY: 0
});
// Positionnement du score du camp ordinateur dans la zone score au depart de la zone ordi
-LK.gui.topLeft.addChild(scoreOrdiText); //Point de reference (0,0)
-scoreOrdiText.x = game.width / 2; //Puis decalage de
+LK.gui.top.addChild(scoreOrdiText); //Point de reference (game.width/2,0)
+scoreOrdiText.x += ComputerZone.width / 2; //Puis decalage a drote
// Fonction de rappel pour le tick
function onGameTick() {
// Autres mises à jour du jeu ici en cours de test..
}
@@ -940,5 +952,13 @@
}
//Mise à jour des scores
updateScoreHumain(scoreHumain);
updateScoreOrdi(scoreOrdi);
+ //Fin de partie
+ if (nbRochers == 0) {
+ if (scoreHumain >= scoreOrdi) {
+ afficheVictoire(humanCamp);
+ } else {
+ afficheVictoire(ordiCamp);
+ }
+ }
});
\ No newline at end of file
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.