Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'scoreTest = this.pushers.length;' Line Number: 816
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: scoreTest is not defined' in or related to this line: 'updateScoreTest(scoreTest);' Line Number: 1028
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: Cannot read properties of null (reading 'sprite')' in or related to this line: 'this.vitesseEnCours = this.sprite.x < rocher.sprite.x ? this.vitessePS : -this.vitessePS; //on donne le sens du deplacement horizontal' Line Number: 765
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: rocher is not defined' in or related to this line: 'rocher[i].sortPushers();' Line Number: 1003
Code edit (1 edits merged)
Please save this source code
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'sprite')' in or related to this line: 'this.vitesseEnCours = this.sprite.x < rocher.sprite.x ? this.vitessePS : -this.vitessePS; //on donne le sens du deplacement horizontal' Line Number: 634
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: 'Uncaught TypeError: Cannot set properties of undefined (setting 'x')' in or related to this line: 'this.sprite.x = x;' Line Number: 439
Code edit (1 edits merged)
Please save this source code
Code edit (21 edits merged)
Please save this source code
User prompt
Migrate to the latest version of LK
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: 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
===================================================================
--- original.js
+++ change.js
@@ -7,9 +7,8 @@
/****
* Game Code
****/
-//PARAMETRES DIVERS DU JEU
/*
Game Zones:
- The game is played on a 2048x2732 pixels screen.
0. let playersZoneWidth = 200;
@@ -17,32 +16,8 @@
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.
@@ -80,8 +55,33 @@
- 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;
@@ -202,9 +202,9 @@
var buldoRockBkHotSpotX = -45; //hotspot arriere du buldoRock
var buldoRockBkHotSpotY = 0;
var buldoZerHotSpotX = 45; //hotspot X du sprite buldoZer, offset du sprite par rapport à l'ancrage
var buldoZerHotSpotY = 0; //hotspot Y du sprite buldoZer
-var buldoZerBkHotSpotX = 45 * 2; //hotspot arriere du buldoZer
+var buldoZerBkHotSpotX = 45; //hotspot arriere du buldoZer
var buldoZerBkHotSpotY = 0;
var ordonneesRestantes = []; //liste des ordonnees non encore utilisees pour le placement des rochers
var petitRocher = 2; //taille du rocher (2=petit, 4=moyen, 8=gros)
var petitRocherDxHotLeft = -25 * 2; //hotspot X du sprite petitRocher, offset du sprite par rapport à l'ancrage
@@ -853,29 +853,33 @@
buldo.yBase = buldo.sprite.y;
buldo.vitessePS = vitesseBuldo;
buldo.sprite.visible = true;
//On ajoute les evenements de clic sur le sprite Buldo
- buldo.sprite.on('down', buldo.onClickBuldo.bind(buldo, buldos));
+ buldo.sprite.on('down', function () {
+ buldo.onClickBuldo(buldos);
+ });
+ buldo.rocherDestination = null;
+ buldo.rocherPushed = null;
//On donne leurs hotspots
if (buldo.camp == humanCamp) {
buldo.dxAvHotSpot = buldoRockHotSpotX; //Hotspot avant du sprite (point de contact avec un rocher) décalage par rapport au point d'ancrage
buldo.dyAvHotSpot = buldoRockHotSpotY;
- buldo.dxBkHotSpot = buldoRockBkHotSpotX; //Offset du point chaud arriere du sprite (point de contact avec un autre Buldo) décalage par rapport au point d'ancrage
+ buldo.dxBkHotSpot = buldoRockBkHotSpotX * 2; //Offset du point chaud arriere du sprite (point de contact avec un autre Buldo) décalage par rapport au point d'ancrage
buldo.dyBkHotSpot = buldoRockBkHotSpotY;
} else if (buldo.camp == ordiCamp) {
buldo.dxAvHotSpot = buldoZerHotSpotX; //Hotspot avant du sprite (point de contact avec un rocher) décalage par rapport au point d'ancrage
buldo.dyAvHotSpot = buldoZerHotSpotY;
- buldo.dxBkHotSpot = buldoZerBkHotSpotX; //Offset du point chaud arriere du sprite (point de contact avec un autre Buldo) décalage par rapport au point d'ancrage
+ buldo.dxBkHotSpot = buldoZerBkHotSpotX * 2; //Offset du point chaud arriere du sprite (point de contact avec un autre Buldo) décalage par rapport au point d'ancrage
buldo.dyBkHotSpot = buldoZerBkHotSpotY;
}
return buldo;
} //fin createSingleBuldo
function createBuldos() {
//CREATION D'OBJETS A PARTIR DES SPRITES //constructor(x, y, camp)
- var buldoRock1 = new Buldo(HumanZone.x + HumanZone.width / 2, HumanZone.y + HumanZone.height / 3, humanCamp);
- var buldoRock2 = new Buldo(HumanZone.x + HumanZone.width / 2, HumanZone.y + 2 * HumanZone.height / 3, humanCamp);
- var buldoZer1 = new Buldo(ComputerZone.x + ComputerZone.width / 2, ComputerZone.y + ComputerZone.height / 3, ordiCamp);
- var buldoZer2 = new Buldo(ComputerZone.x + ComputerZone.width / 2, ComputerZone.y + 2 * ComputerZone.height / 3, ordiCamp);
+ var buldoRock1 = createSingleBuldo(HumanZone.x + HumanZone.width / 2, HumanZone.y + HumanZone.height / 3, humanCamp);
+ var buldoRock2 = createSingleBuldo(HumanZone.x + HumanZone.width / 2, HumanZone.y + 2 * HumanZone.height / 3, humanCamp);
+ var buldoZer1 = createSingleBuldo(ComputerZone.x + ComputerZone.width / 2, ComputerZone.y + ComputerZone.height / 3, ordiCamp);
+ var buldoZer2 = createSingleBuldo(ComputerZone.x + ComputerZone.width / 2, ComputerZone.y + 2 * ComputerZone.height / 3, ordiCamp);
//On stocke les objets dans un tableau
var buldos = [];
buldos.push(buldoRock1);
buldos.push(buldoRock2);
@@ -889,13 +893,8 @@
buldoZer1.name = 'buldoZer1';
buldoZer1.vitessePS = vitesseBuldo;
buldoZer2.name = 'buldoZer2';
buldoZer2.vitessePS = vitesseBuldo;
- //On donne leur point d'ancrage
- buldoRock1.sprite.anchor.set(0.5, 0.5);
- buldoRock2.sprite.anchor.set(0.5, 0.5);
- buldoZer1.sprite.anchor.set(0.5, 0.5);
- buldoZer2.sprite.anchor.set(0.5, 0.5);
//On initialise leurs positions de base xBase et yBase
buldoRock1.xBase = buldoRock1.sprite.x;
buldoRock1.yBase = buldoRock1.sprite.y;
buldoRock1.sprite.visible = true;
@@ -907,27 +906,8 @@
buldoZer1.sprite.visible = true;
buldoZer2.xBase = buldoZer2.sprite.x;
buldoZer2.yBase = buldoZer2.sprite.y;
buldoZer2.sprite.visible = true;
- //On ajoute les evenements de clic sur les sprites Buldo
- for (var i = 0; i < buldos.length; i++) {
- buldos[i].sprite.on('down', buldos[i].onClickBuldo.bind(buldos[i], buldos));
- buldos[i].rocherDestination = null;
- buldos[i].rocherPushed = null;
- //On donne leurs hotspots
- if (buldos[i].camp == humanCamp) {
- buldos[i].dxAvHotSpot = buldoRockHotSpotX; //Hotspot avant du sprite (point de contact avec un rocher) décalage par rapport au point d'ancrage
- buldos[i].dyAvHotSpot = buldoRockHotSpotY;
- buldos[i].dxBkHotSpot = buldoRockBkHotSpotX * 2; //Offset du point chaud arriere du sprite (point de contact avec un autre Buldo) décalage par rapport au point d'ancrage
- buldos[i].dyBkHotSpot = buldoRockBkHotSpotY;
- } else if (buldos[i].camp == ordiCamp) {
- buldos[i].dxAvHotSpot = buldoZerHotSpotX; //Hotspot avant du sprite (point de contact avec un rocher) décalage par rapport au point d'ancrage
- buldos[i].dyAvHotSpot = buldoZerHotSpotY;
- buldos[i].dxBkHotSpot = buldoZerBkHotSpotX; //Offset du point chaud arriere du sprite (point de contact avec un autre Buldo) décalage par rapport au point d'ancrage
- buldos[i].dyBkHotSpot = buldoZerBkHotSpotY;
- }
- }
- ; // Fonction de callback pour le clic gauche sur les sprites.
return buldos;
} //fin de createBuldos
var buldos = createBuldos(); //Creation des Buldos
var rochers = generateRandomRock(nbRochers); //création des rochers
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.