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
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
===================================================================
--- original.js
+++ change.js
@@ -218,9 +218,9 @@
var grosRocherDxHotLeft = -45 * 2; //hotspot X du sprite grosRocher, offset du sprite par rapport à l'ancrage
var grosRocherDyHotLeft = 0; //hotspot Y du sprite grosRocher
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 = 400; //temps en ticks avant division du rocher bloque
+var timeBeforeSplit = 200; //temps en ticks avant division du rocher bloque
var nbTicksBeforeStopFlashing = 10; //nombre de ticks avant d'arreter de clignoter
var rocher_split_sprite = game.addChild(LK.getAsset('pouf', {
anchorX: 0.5,
anchorY: 0.5
@@ -229,11 +229,11 @@
var typeLigneHtoX = 2; //Type 2 = déplacement horizontal vers une position X
var typeLigneVtoY = 3; //Type 3 = déplacement vertical vers une position Y
var typeLigneHtoR = 4; //Type 4 = déplacement horizontal vers un rocher
var gameHasStarted = false; //Flag qui indique si le jeu a commence (premiers clics buldo puis rocher)
+var activeCamp = 0; //Camp selectionne par le joueur
var humanCamp = 1; //camp du joueur humain
var ordiCamp = -1; //camp du joueur ordinateur
-var activeCamp = 0; //Camp selectionne par le joueur
var scoreHumain = 0;
var scoreOrdi = 0;
var scoreTest = 0; // Define scoreTest variable
var ScoreZone = {
@@ -265,8 +265,11 @@
y: ScoreZone.height,
width: game.width - HumanZone.width - ComputerZone.width,
height: game.height - OptionsZone.height - ScoreZone.height
};
+//Ajout d'un fond a la zone route
+var route_sprite = game.addChild(LK.getAsset('zoneRoute', {}));
+route_sprite.width *= 2.0;
//CLASS ROCHER
var Rocher = /*#__PURE__*/_createClass(function Rocher() {
var tailleRocher = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : petitRocher;
var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : RoadZone.width / 2;
@@ -356,17 +359,16 @@
if (buldoCheck.isSelected) {
buldo = buldoCheck;
if (activeCamp == 0) {
//On fixe le camp actif choisi par le joueur
- activeCamp = this.camp;
+ activeCamp = buldo.camp;
}
}
}
});
//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
- scoreTest = this.timeToReach(buldo.sprite.x, buldo.sprite.y); //On teste le score
+ buldo.rochersCibles.push(this); //On stock le prochain rocher cible
}
}
}; //fin onClickRocherBuldo
this.timeToReach = function (x, y) {
@@ -507,9 +509,9 @@
this.vitesseAngulaireDS = 2.0; //vitesse de rotation du sprite en degres par secondes
this.vitesseAngulaireRms = 0.0; //vitesse angulaire en radians par millisecondes
this.onClickBuldo = function (buldos) {
//On exclu le clic sur l'autre camp si un camp est actif
- if (this.camp != activeCamp) {
+ if (activeCamp != 0 && this.camp != activeCamp) {
return;
}
//On deselectionne tous les sprites Buldo
for (var i = 0; i < buldos.length; i++) {
@@ -965,8 +967,33 @@
// Autres mises à jour du jeu ici en cours de test..
}
// Instead of directly calling checkMovesStack, iterate over buldos and call checkMovesStack for each
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):
+ //Pour chaque Buldo du camp non actif, on copie la liste des rochers (rochers) et on la trie par ordre de temps de poussee croissant (timeToReach)
+ //Puis on met dans la pile des rochers cibles du Buldo du camp non actif, tous les rochers de cette liste triee
+ if (activeCamp != 0 && !gameHasStarted) {
+ var campNonActif = activeCamp == humanCamp ? ordiCamp : humanCamp;
+ var buldosCampNonActif = [];
+ buldos.forEach(function (buldo) {
+ if (buldo.camp == campNonActif) {
+ buldosCampNonActif.push(buldo);
+ }
+ });
+ if (buldosCampNonActif) {
+ buldosCampNonActif.forEach(function (buldo) {
+ var rochersCopy = rochers.slice();
+ rochersCopy.sort(function (a, b) {
+ return a.timeToReach(buldo.sprite.x, buldo.sprite.y) - b.timeToReach(buldo.sprite.x, buldo.sprite.y);
+ });
+ rochersCopy.forEach(function (rocher) {
+ buldo.rochersCibles.push(rocher);
+ });
+ });
+ }
+ gameHasStarted = true;
+ }
//Animation des Buldos
if (buldos) {
buldos.forEach(function (buldo) {
buldo.isMoving = buldo.isMovingH || buldo.isMovingV || buldo.isMovingR || buldo.isRotating;
@@ -1044,9 +1071,9 @@
}
//Mise à jour des scores
updateScoreHumain(scoreHumain);
updateScoreOrdi(scoreOrdi);
- updateScoreTest(scoreTest);
+ //updateScoreTest(scoreTest);
//Fin de partie
if (nbRochers <= 0) {
if (scoreHumain >= scoreOrdi) {
afficheVictoire(humanCamp);
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.