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
User prompt
Please fix the bug: 'ReferenceError: rocher_pouf_sprite is not defined' in or related to this line: 'rocher.sprite = rocher_pouf_sprite;' Line Number: 1010
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.wait is not a function' in or related to this line: 'LK.wait(4000, function () {' Line Number: 1009
Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'rocher_pouf_sprite')' in or related to this line: 'rocher.sprite = self.rocher_pouf_sprite;' Line Number: 1003
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.getTick is not a function' in or related to this line: 'rocher.sprite.alpha = Math.abs(Math.sin(LK.getTick() / 100)); //Clignotement du rocher' Line Number: 991
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: rocher is undefined' in or related to this line: 'var sens = this.yBase < rocher.sprite.y ? 1 : -1; //Calcul du sens de deplacement verticale : 1=bas, -1=haut' Line Number: 735
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: rochersCibles is not defined' in or related to this line: 'scoreTest = rochersCibles.length;' Line Number: 750
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: this.srite is undefined' in or related to this line: 'if (this.rochersCibles.length == 0 && this.srite.y != this.yBase) {' Line Number: 745
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: yBase is not defined' in or related to this line: 'sens = this.sprite.y == yBase ? -sens : sens; //Si le Buldo par face a la route, il doit se tourner vers le rocher' Line Number: 737
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -7,8 +7,9 @@
/****
* Game Code
****/
+//PARAMETRES DIVERS DU JEU
/*
Game Zones:
- The game is played on a 2048x2732 pixels screen.
0. let playersZoneWidth = 200;
@@ -16,8 +17,32 @@
2. let OptionsZone = {x: 0, y: app.screen.height-200, width: app.screen.width, height: 200};
3. let HumanZone = {x: 0, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
4. let ComputerZone = {x: app.screen.width-playersZoneWidth, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
5. let RoadZone = {x: playersZoneWidth, y: 200, width: app.screen.width-HumanZone.width-OrdiZone.width, height: app.screen.height-OptionsZone.height-ScoreZone.height};
+- At the start of the game, 10 rocks of three different sizes are randomly placed in the RoadZone.
+- Each player has two bulldozers to move the rocks.
+- A bulldozer moving without pushing anything has a base speed V.
+- When a bulldozer pushes a small rock, the combined speed is V/2.
+- When a bulldozer pushes a medium rock, the combined speed is V/4.
+- When a bulldozer pushes a large rock, the combined speed is V/8.
+- When two bulldozers push a rock together, one behind the other, the pushing speeds are doubled compared to the speed of a single bulldozer.
+- The human player clicks on a rock to command the nearest free bulldozer to push it towards the ComputerZone.
+- The computer-controlled bulldozers randomly choose a rock and push it towards the HumanZone.
+- If a human bulldozer is free, the player can click on a rock already being pushed to have the bulldozer move behind the first one and push the rock faster.
+- It is possible to push a rock that is being pushed by the opponent to block or slow down its movement. If a second bulldozer is added in this situation, the rock will be pushed in the direction where there are fewer bulldozers.
+- The game ends when all rocks have been moved out of the RoadZone. The winner is the one with the highest score, based on the number and size of rocks successfully moved to the opposing zone.
+- The goal for the human player is to move all the rocks to the ComputerZone while preventing the computer from doing the same. Effective strategy and skillful bulldozer management are necessary to maximize the score.
+There is no time limit in this game, and players must use their judgment to determine the best way to move rocks and use their bulldozers to win the game.
+*/
+/*
+Game Zones:
+- The game is played on a 2048x2732 pixels screen.
+0. let playersZoneWidth = 200;
+1. let ScoreZone = {x: 0, y: 0, width: app.screen.width, height: 200};
+2. let OptionsZone = {x: 0, y: app.screen.height-200, width: app.screen.width, height: 200};
+3. let HumanZone = {x: 0, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
+4. let ComputerZone = {x: app.screen.width-playersZoneWidth, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
+5. let RoadZone = {x: playersZoneWidth, y: 200, width: app.screen.width-HumanZone.width-OrdiZone.width, height: app.screen.height-OptionsZone.height-ScoreZone.height};
Game settings:
- At the start of the game, 10 rocks of three different sizes (small, medium, large) are randomly placed in the RoadZone.
- The rocks have square 100x100 pixels sprites centered (anchor 0.5, 0.5).
- The Rocks have a front and a back zone to simulate a contact area with the Buldos.
@@ -55,33 +80,8 @@
- The winner is the one with the highest score, based on the number and size of rocks successfully moved to the opposing zone (small rock is 1 point, medium rock is 2 points, large rock is 3 points).
- The goal for the human player is to move all the rocks to the ComputerZone while preventing the computer from doing the same.
- There is no time limit in this game, and players must use their judgment to determine the best way to move rocks and use their Buldos to win the game.
*/
-/*
-Game Zones:
-- The game is played on a 2048x2732 pixels screen.
-0. let playersZoneWidth = 200;
-1. let ScoreZone = {x: 0, y: 0, width: app.screen.width, height: 200};
-2. let OptionsZone = {x: 0, y: app.screen.height-200, width: app.screen.width, height: 200};
-3. let HumanZone = {x: 0, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
-4. let ComputerZone = {x: app.screen.width-playersZoneWidth, y: 200, width: playersZoneWidth, height: app.screen.height-OptionsZone.height-ScoreZone.height};
-5. let RoadZone = {x: playersZoneWidth, y: 200, width: app.screen.width-HumanZone.width-OrdiZone.width, height: app.screen.height-OptionsZone.height-ScoreZone.height};
-- At the start of the game, 10 rocks of three different sizes are randomly placed in the RoadZone.
-- Each player has two bulldozers to move the rocks.
-- A bulldozer moving without pushing anything has a base speed V.
-- When a bulldozer pushes a small rock, the combined speed is V/2.
-- When a bulldozer pushes a medium rock, the combined speed is V/4.
-- When a bulldozer pushes a large rock, the combined speed is V/8.
-- When two bulldozers push a rock together, one behind the other, the pushing speeds are doubled compared to the speed of a single bulldozer.
-- The human player clicks on a rock to command the nearest free bulldozer to push it towards the ComputerZone.
-- The computer-controlled bulldozers randomly choose a rock and push it towards the HumanZone.
-- If a human bulldozer is free, the player can click on a rock already being pushed to have the bulldozer move behind the first one and push the rock faster.
-- It is possible to push a rock that is being pushed by the opponent to block or slow down its movement. If a second bulldozer is added in this situation, the rock will be pushed in the direction where there are fewer bulldozers.
-- The game ends when all rocks have been moved out of the RoadZone. The winner is the one with the highest score, based on the number and size of rocks successfully moved to the opposing zone.
-- The goal for the human player is to move all the rocks to the ComputerZone while preventing the computer from doing the same. Effective strategy and skillful bulldozer management are necessary to maximize the score.
-There is no time limit in this game, and players must use their judgment to determine the best way to move rocks and use their bulldozers to win the game.
-*/
-//PARAMETRES DIVERS DU JEU
function _typeof2(o) {
"@babel/helpers - typeof";
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
@@ -673,9 +673,8 @@
return;
}
if (this.isMovingR) {
if (this.rocherDestination && this.rocherDestination.sprite != null) {
- //var xTarget = this.checkForce(); //Abscisse x du point chaud AV du rocher ou du point chaud arriere du Buldo allie poussant
var xTarget = this.checkTarget(); //Abscisse x du point chaud AV du rocher ou du point chaud arriere du Buldo allie poussant
} else {
return; // Exit the function if rocherDestination or its sprite is null
}
@@ -702,35 +701,34 @@
}
}
return;
}; // fin deplaceHtoR
- this.moveBackToBase = function () {
- //Deplacement du Buldo vers sa position de base lors du retour au camp ()
- //D'abord il se tourne verticalement vers sa position de base
+ this.moveBackToBase = function (rocher) {
+ //Deplacement du Buldo vers sa position de base lors du retour au camp
+ //D'abord il se tourne verticalement vers sa position de base (si au depart sa position de base etait en dessous du rocher, il se tourne vers le bas (angle = 0), sinon vers le haut (angle = 180)
//Puis il se deplace verticalement vers sa position de base
- //Puis il se tourne pour faire face a la route
- var sens = this.sprite.y < this.yBase ? 1 : -1; //Calcul du sens de deplacement horizontale : 1=droite, -1=gauche
- sens = this.camp == humanCamp ? sens : -sens; //Test Si le Buldo est humain, il doit arriver horizontalement par la gauche (abscisse croissante), sinon par la droite (abscisse decroissante)
+ //Puis il se tourne pour faire face a la route
+ var sens = this.yBase < rocher.sprite.y ? 1 : -1; //Calcul du sens de deplacement verticale : 1=bas, -1=haut
+ sens = this.camp == humanCamp ? sens : -sens; //L'inverse pour les ordis
this.addMoveToStack(typeRotation, sens * 90, 0); //Rotation de 90 degres vers l'ordonnee de la position de base
- this.addMoveToStack(typeLigneVtoY, this.xBase, this.yBase); //Deplacement vertical vers l'ordonnee de la position de base
- this.addMoveToStack(typeRotation, sens * 90, 0); //Rotation de 90 degres vers la route
+ this.addMoveToStack(typeLigneVtoY, this.xBase, this.yBase); //Deplacement vertical vers la position de base
+ this.addMoveToStack(typeRotation, sens * 90, 0); //Rotation de 90 degres pour faire face a la route
}; //fin moveBackToBase
this.moveToRock = function (rocher) {
x = this.camp == humanCamp ? x + rocher.dxHotLeftSpot : x + rocher.dxHotRightSpot;
y = rocher.sprite.y;
this.rocherDestination = rocher; //Le buldo a pour destination le sprite rocher cliqué
rocher.pushers.push(this); //On ajoute le Buldo a la liste des Buldos qui poussent le rocher
- scoreTest = rocher.pushers ? rocher.pushers.length : 0; //Controle du contenu de pushers
- var sens = this.sprite.y < y ? 1 : -1; //Calcul du sens de deplacement horizontale : 1=droite, -1=gauche
+ var sens = this.sprite.y < y ? 1 : -1; //Calcul du sens de rotation : 1=horaire, -1=antihoraire
sens = this.camp == humanCamp ? sens : -sens; //Test Si le Buldo est humain, il doit arriver horizontalement par la gauche (abscisse croissante), sinon par la droite (abscisse decroissante)
this.addMoveToStack(typeRotation, sens * 90, 0); //Rotation de 90 degres vers l'ordonnee du rocher
this.addMoveToStack(typeLigneVtoY, 0, y); //Deplacement vertical vers l'ordonnee du rocher
this.addMoveToStack(typeRotation, -sens * 90, 0); //Rotation de 90 degres vers le rocher
this.addMoveToStack(typeLigneHtoR, rocher, 0); //Deplacement vers le rocher jusqu'au contact s'il n'est pas detruit avant
this.addMoveToStack(typeRotation, 180, 0); //Demi tour vers le camp de base
this.addMoveToStack(typeLigneHtoX, this.xBase + this.camp * this.dxAvHotSpot, 0); //Deplacement jusqu'au camp de base
//this.addMoveToStack(typeRotation, -180, 0); //Demi tour pret a repartir
- this.moveBackToBase(); //Retour au camp de base
+ //this.moveBackToBase(rocher); //Retour au camp de base
}; //fin moveToRock
}); //fin constructor
function sensRotation(angleDegres) {
//03/03/2024//entre 0 et 180: 1, entre 180 et 360: -1, 0: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.