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
User prompt
Please fix the bug: 'Uncaught ReferenceError: buldorock_sprite is not defined' in or related to this line: 'this.sprite = buldorock_sprite;' Line Number: 505
User prompt
Please fix the bug: 'Uncaught ReferenceError: buldorock_sprite is not defined' in or related to this line: 'this.sprite = buldorock_sprite;' Line Number: 505
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: 'Uncaught ReferenceError: coupeVictoire is not defined' in or related to this line: 'LK.gui.top.addChild(coupeVictoire);' Line Number: 1001
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: 'Uncaught TypeError: Graphics is not a constructor' in or related to this line: 'var routeZone = new Graphics();' Line Number: 292
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Manque t'il route_sprite.x *= -1;
Code edit (1 edits merged)
Please save this source code
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: 'TypeError: rochers[i] is undefined' in or related to this line: 'if (rochers[i].isClicked) {' Line Number: 1029
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -353,9 +353,9 @@
//Action à effectuer lorsqu'on clique sur un rocher
//Récupération des coordonnées du sprite rocher cliqué
var x = this.sprite.x;
var y = this.sprite.y;
- //this.sprite.tint = 0xF0D0E0; //on ajoute un filtre coloré
+ this.sprite.tint = 0xF0B030; //on ajoute un filtre coloré
self.isClicked = true; //Le rocher est clique
//Parcours de la liste des buldos pour trouver le buldo selectionne
if (buldos) {
var buldo = null;
@@ -372,8 +372,11 @@
});
//Si le buldo selectionne est trouve, on le deplace vers le sprite rocher ou on stock le prochain rocher cible
if (buldo != null) {
buldo.rochersCibles.push(this); //On stock le prochain rocher cible
+ } else {
+ //Sinon on retire la teinte du rocher
+ this.sprite.tint = 0xFFFFFF;
}
}
}; //fin onClickRocherBuldo
this.timeToReach = function (x, y) {
@@ -722,8 +725,9 @@
if (this.rocherDestination != null || this.rocherPushed != null) {
this.isMovingR = true; // on indique que le Buldo est en mouvement
} else {
this.isMovingR = false; // on indique que le Buldo n'est plus en train de pousser un rocher
+ this.lastHD = 0; // on remet la dernière direction horizontale à 0
return;
}
if (this.isMovingR) {
if (this.rocherDestination && this.rocherDestination.sprite != null) {
@@ -748,17 +752,18 @@
this.rocherDestination.pushedByOrdi = this; // on indique le Buldo qui pousse le rocher
}
}
} else {
+ var isTooFar = this.camp == humanCamp ? this.sprite.x > this.rocherDestination.sprite.x : this.sprite.x < this.rocherDestination.sprite.x; //Le Buldo est trop loin du rocher
var AD = dist(this.sprite.x, 0, xTarget, 0); //Distance entre le centre du sprite et l'abscisse x destination
var Bh = this.sprite.x + this.camp * this.dxAvHotSpot; //Abscisse x du point chaud AV du sprite
var AH = dist(this.sprite.x, 0, this.sprite.x + this.camp * this.dxAvHotSpot, 0); //Distance entre le centre du sprite et le point chaud AV
var dxHotSpotR = this.camp == humanCamp ? this.rocherDestination.dxHotLeftSpot : this.rocherDestination.dxHotRightSpot; //Point chaud du rocher
var Rh = this.rocherDestination.sprite.x + dxHotSpotR; //Abscisse x du point chaud du rocher
if (AH <= AD) {
//Securite au cas ou le point destination se trouve entre le centre du sprite et le point chaud AV du sprite
this.sprite.x += this.vitesseEnCours * delta; // Sinon on déplace le sprite horizontalement
- } else if (AH > AD || Bh > Rh) {
+ } else if (AH > AD || Bh > Rh || isTooFar) {
//Securite au cas ou le buldo depasse le point chaud du rocher
this.sprite.x -= this.vitesseEnCours * delta; //Sinon il recule pour se repositionner derriere
}
}
@@ -822,18 +827,22 @@
LK.gui.topLeft.addChild(victoireText);
victoireText.x = camp == humanCamp ? HumanZone.width : game.width / 2;
victoireText.y = ScoreZone.height;
} //fin afficheVictoire
-function createSingleRock(size) {
+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) {
return null;
}
var index = Math.floor(Math.random() * ordonneesRestantes.length);
var y = ordonneesRestantes[index];
ordonneesRestantes.splice(index, 1); //On supprime l'ordonnee choisie de la liste des ordonnees restantes
- var rock = new Rocher(size, RoadZone.x + RoadZone.width / 2, y);
+ // Choisir une abscisse aléatoire pour le rocher
+ var zoneMinix = RoadZone.x + 100;
+ var zoneMaxix = RoadZone.x + RoadZone.width - 100;
+ var x = Math.random() * (zoneMaxix - zoneMinix) + zoneMinix;
+ var rock = new Rocher(size, x, y);
rock.sprite.visible = true;
rock.sprite.anchor.set(0.5, 0.5);
if (size == petitRocher) {
rock.dxHotLeftSpot = petitRocherDxHotLeft;
@@ -854,11 +863,10 @@
rock.dyHotRightSpot = grosRocherDyHotRight;
}
rock.totalForce = 0;
rock.sprite.on('down', rock.onClickRocherBuldo.bind(rock, buldos));
- nbRochers += 1;
return rock;
-} //fin createSingleRock
+} //fin createSingleRandomRock
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;
@@ -870,46 +878,16 @@
//Securite : si le nombre de rochers demande est superieur au nombre d'ordonnees possibles, on ajuste le nombre de rochers
if (nombreRochers > ordonneesPossibles.length) {
nombreRochers = ordonneesPossibles.length;
}
- var rochers = [];
//Creation des rochers
+ var rochers = [];
+ ordonneesRestantes = ordonneesPossibles; //On stocke les ordonnees restantes pour une utilisations ulterieure
for (var i = 0; i < nombreRochers; i++) {
// Choisir une taille de rocher aléatoire
var sizes = [petitRocher, moyenRocher, grosRocher];
var size = sizes[Math.floor(Math.random() * sizes.length)];
- // Choisir une abscisse aléatoire pour le rocher
- var zoneMinix = RoadZone.x + 100;
- var zoneMaxix = RoadZone.x + RoadZone.width - 100;
- var x = Math.random() * (zoneMaxix - zoneMinix) + zoneMinix;
- //Choix d'une ordonnee aleatoire en supprimant l'ordonnee choisie precedemment
- var index = Math.floor(Math.random() * ordonneesPossibles.length);
- var y = ordonneesPossibles[index];
- ordonneesPossibles.splice(index, 1);
- // Créer le rocher
- var rock = new Rocher(size, x, y);
- rock.sprite.visible = true;
- rock.sprite.anchor.set(0.5, 0.5);
- if (size == petitRocher) {
- rock.dxHotLeftSpot = petitRocherDxHotLeft;
- rock.dyHotLeftSpot = petitRocherDyHotLeft;
- rock.dxHotRightSpot = petitRocherDxHotRight;
- rock.dyHotRightSpot = petitRocherDyHotRight;
- }
- if (size == moyenRocher) {
- rock.dxHotLeftSpot = moyenRocherDxHotLeft;
- rock.dyHotLeftSpot = moyenRocherDyHotLeft;
- rock.dxHotRightSpot = moyenRocherDxHotRight;
- rock.dyHotRightSpot = moyenRocherDyHotRight;
- }
- if (size == grosRocher) {
- rock.dxHotLeftSpot = grosRocherDxHotLeft;
- rock.dyHotLeftSpot = grosRocherDyHotLeft;
- rock.dxHotRightSpot = grosRocherDxHotRight;
- rock.dyHotRightSpot = grosRocherDyHotRight;
- }
- //Initialisation de parametres
- rock.totalForce = 0;
+ var rock = createSingleRandomRock(size);
rochers.push(rock);
}
//On ajoute les evenements de clic sur les sprites rocher
for (var i = 0; i < rochers.length; i++) {
@@ -1001,8 +979,18 @@
anchorX: 0.5,
anchorY: 0
});
//LK.gui.top.addChild(scoreFictifText);
+//Creation de l'objet coupe de la victoire a partir de l'image coupeVictoire entre les deux scores
+var coupeVictoire = game.addChild(LK.getAsset('coupeVictoire', {
+ anchorX: 0.5,
+ anchorY: 0
+}));
+coupeVictoire.x = game.width / 2;
+coupeVictoire.y = ScoreZone.height;
+LK.gui.top.addChild(coupeVictoire);
+coupeVictoire.x = game.width / 2;
+coupeVictoire.y = ScoreZone.height;
// Fonction de rappel pour le tick
function onGameTick() {
// Autres mises à jour du jeu ici en cours de test..
}
@@ -1108,23 +1096,39 @@
var taille = rocher.tailleRocher;
var rocher1 = null;
var rocher2 = null;
if (taille == grosRocher) {
- rocher1 = createSingleRock(moyenRocher);
- rocher2 = createSingleRock(petitRocher);
- rocher1.sprite.visible = true;
- rocher2.sprite.visible = true;
- rochers.push(rocher1);
- rochers.push(rocher2);
+ rocher1 = createSingleRandomRock(moyenRocher);
+ if (rocher1) {
+ rocher1.sprite.visible = true;
+ rochers.push(rocher1);
+ nbRochers += 1;
+ }
+ rocher2 = createSingleRandomRock(petitRocher);
+ if (rocher2) {
+ rocher2.sprite.visible = true;
+ rochers.push(rocher2);
+ nbRochers += 1;
+ }
}
if (taille == moyenRocher) {
- rocher1 = createSingleRock(petitRocher);
- rocher1.sprite.visible = true;
- rochers.push(rocher1);
+ rocher1 = createSingleRandomRock(petitRocher);
+ if (rocher1) {
+ rocher1.sprite.visible = true;
+ rochers.push(rocher1);
+ nbRochers += 1;
+ }
+ rocher2 = createSingleRandomRock(petitRocher);
+ if (rocher2) {
+ rocher2.sprite.visible = true;
+ rochers.push(rocher2);
+ nbRochers += 1;
+ }
}
//On supprime le rocher detruit de la liste des rochers
rocher.destroy();
});
+ gameHasStarted = false; //On remet le jeu en attente de lancement pour que les ordinateurs choisissent de nouveaux rochers a pousser
}
rochersToDestroy = []; //On vide le tableau des rochers a detruire
//}, 4000);
}
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.