Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'onClickBuldo')' in or related to this line: 'self.onClickBuldo = function (buldos) {' Line Number: 388
Code edit (1 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: 'var buldoZer1 = new Buldo(OrdiZone.x + OrdiZone.width / 2, OrdiZone.y + OrdiZone.height / 3, ordiCamp);' Line Number: 425
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: dxHotSpot is not defined' in or related to this line: 'this.dxAvHotSpot = dxHotSpot; //Offset du point chaud du sprite (point de contact avec le rocher) décalage par rapport au point d'ancrage' Line Number: 353
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: 336
User prompt
Please fix the bug: 'Uncaught ReferenceError: sprite is not defined' in or related to this line: 'this.sprite = sprite;' Line Number: 335
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: self.attachAsset is not a function' in or related to this line: 'var rocher_gros_sprite = self.attachAsset('large_rock', {' Line Number: 230
User prompt
Please fix the bug: 'Uncaught TypeError: self.attachAsset is not a function' in or related to this line: 'var rocher_moyen_sprite = self.attachAsset('medium_rock', {' Line Number: 226
User prompt
Please fix the bug: 'Uncaught TypeError: self.attachAsset is not a function' in or related to this line: 'var rocher_petit_sprite = self.attachAsset('small_rock', {' Line Number: 222
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: _this is not defined' in or related to this line: 'var rocher_petit_sprite = _this.attachAsset('small_rock', {' Line Number: 222
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'name')' in or related to this line: 'self.name = "rocher";' Line Number: 211
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'var zoneMiniy = RoadZone.y;' Line Number: 280
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: playersZoneWidth is not defined' in or related to this line: 'var RoadZone = {' Line Number: 280
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'width')' in or related to this line: 'var ComputerZone = {' Line Number: 138
Code edit (3 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: humanZoneInstance is undefined' in or related to this line: 'var RoadZone = {' Line Number: 459
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -8,8 +8,9 @@
/****
* Game Code
****/
+var rochers = generateRandomRock(nbRochers); //création des rochers
//PARAMETRES DIVERS DU JEU
/*
Game Zones:
- The game is played on a 2048x2732 pixels screen.
@@ -76,8 +77,62 @@
- 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.
*/
+function _typeof(o) {
+ "@babel/helpers - typeof";
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
+ return typeof o;
+ } : function (o) {
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
+ }, _typeof(o);
+}
+function _defineProperties(target, props) {
+ for (var i = 0; i < props.length; i++) {
+ var descriptor = props[i];
+ descriptor.enumerable = descriptor.enumerable || false;
+ descriptor.configurable = true;
+ if ("value" in descriptor) {
+ descriptor.writable = true;
+ }
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
+ }
+}
+function _createClass(Constructor, protoProps, staticProps) {
+ if (protoProps) {
+ _defineProperties(Constructor.prototype, protoProps);
+ }
+ if (staticProps) {
+ _defineProperties(Constructor, staticProps);
+ }
+ Object.defineProperty(Constructor, "prototype", {
+ writable: false
+ });
+ return Constructor;
+}
+function _toPropertyKey(t) {
+ var i = _toPrimitive(t, "string");
+ return "symbol" == _typeof(i) ? i : String(i);
+}
+function _toPrimitive(t, r) {
+ if ("object" != _typeof(t) || !t) {
+ return t;
+ }
+ var e = t[Symbol.toPrimitive];
+ if (void 0 !== e) {
+ var i = e.call(t, r || "default");
+ if ("object" != _typeof(i)) {
+ return i;
+ }
+ throw new TypeError("@@toPrimitive must return a primitive value.");
+ }
+ return ("string" === r ? String : Number)(t);
+}
+function _classCallCheck(instance, Constructor) {
+ if (!(instance instanceof Constructor)) {
+ throw new TypeError("Cannot call a class as a function");
+ }
+}
var nbRochers = 10; //nombre de rochers
var vitesseBuldo = 8.0; //vitesse de déplacement des buldos a vide, vitesse/2 quand ils poussent un petit rocher, vitesse/4 pour un moyen, vitesse/8 pour un gros
var humanCamp = 1; //camp du joueur humain
var ordiCamp = -1; //camp du joueur ordinateur
@@ -107,8 +162,10 @@
var grosRocherDyHotRight = 0; //hotspot Y du sprite grosRocher
var typeRotation = 1; //Type 1 = rotation
var typeLigneHtoX = 2; //Type 2 = déplacement horizontal vers une position X
var typeLigneVtoY = 3;
+var scoreHumain = 0;
+var scoreOrdi = 0;
var ScoreZone = {
x: 0,
y: 0,
width: game.width,
@@ -131,10 +188,120 @@
y: ScoreZone.height,
width: game.width / 10,
height: HumanZone.height
};
+var playersZoneWidth = 200;
var RoadZone = {
x: HumanZone.width,
y: ScoreZone.height,
width: game.width - HumanZone.width - ComputerZone.width,
height: game.height - OptionsZone.height - ScoreZone.height
-};
\ No newline at end of file
+};
+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;
+ var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : RoadZone.height / 2;
+ _classCallCheck(this, Rocher);
+ self.name = "rocher";
+ self.dxHotLeftSpot = petitRocherDxHotLeft; //Offset du point chaud du sprite (point de contact avec le rocher a gauche) décalage par rapport au point d'ancrage
+ self.dyHotLeftSpot = petitRocherDyHotLeft;
+ self.dxHotRightSpot = petitRocherDxHotRight; //Offset du point chaud du sprite (point de contact avec le rocher a droite) décalage par rapport au point d'ancrage
+ self.dyHotRightSpot = petitRocherDyHotRight;
+ self.isBeingPushed = false; //Flag qui indique si le rocher est pousse par un buldo
+ self.vitesse = 0.0;
+ self.pushedByHuman = null; //BuldoRock qui pousse le rocher
+ self.pushedByOrdi = null; //BuldoZer qui pousse le rocher
+ self.totalPushers = 0; //Nombre de buldos qui poussent le rocher (+1 pour un buldoRock, -1 pour un buldoZer)
+ var rocher_petit_sprite = _this.attachAsset('small_rock', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var rocher_moyen_sprite = _this.attachAsset('medium_rock', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var rocher_gros_sprite = _this.attachAsset('large_rock', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.tailleRocher = tailleRocher;
+ if (self.tailleRocher == petitRocher) {
+ self.sprite = rocher_petit_sprite;
+ }
+ if (self.tailleRocher == moyenRocher) {
+ self.sprite = rocher_moyen_sprite;
+ }
+ if (self.tailleRocher == grosRocher) {
+ self.sprite = rocher_gros_sprite;
+ }
+ self.sprite.x = x;
+ self.sprite.y = y;
+ self.sprite.anchor.set(0.5);
+ self.sprite.scale.set(1.0);
+ if (self.tailleRocher == petitRocher) {
+ self.dxHotLeftSpot = petitRocherDxHotLeft;
+ self.dyHotLeftSpot = petitRocherDyHotLeft;
+ self.dxHotRightSpot = petitRocherDxHotRight;
+ self.dyHotRightSpot = petitRocherDyHotRight;
+ }
+ if (self.tailleRocher == moyenRocher) {
+ self.dxHotLeftSpot = moyenRocherDxHotLeft;
+ self.dyHotLeftSpot = moyenRocherDyHotLeft;
+ self.dxHotRightSpot = moyenRocherDxHotRight;
+ self.dyHotRightSpot = moyenRocherDyHotRight;
+ }
+ if (self.tailleRocher == grosRocher) {
+ self.dxHotLeftSpot = grosRocherDxHotLeft;
+ self.dyHotLeftSpot = grosRocherDyHotLeft;
+ self.dxHotRightSpot = grosRocherDxHotRight;
+ self.dyHotRightSpot = grosRocherDyHotRight;
+ }
+ if (self.tailleRocher == petitRocher) {
+ self.name = "Petit Rocher";
+ }
+ if (self.tailleRocher == moyenRocher) {
+ self.name = "Moyen Rocher";
+ }
+ if (self.tailleRocher == grosRocher) {
+ self.name = "Gros Rocher";
+ }
+}); //fin class Rocher
+function generateRandomRock(nombreRochers) {
+ //Calcul de positions aléatoire pour les rochers dans la zone de route
+ // Define RoadZone with correct dimensions before using it
+ var RoadZone = {
+ x: playersZoneWidth,
+ y: 200,
+ width: game.width - humanZoneInstance.width - computerZoneInstance.width,
+ height: game.height - OptionsZone.height - ScoreZone.height
+ };
+ var zoneMiniy = RoadZone.y;
+ var zoneMaxiy = RoadZone.y + RoadZone.height;
+ //Calcul des ordonnees possibles pour les rochers entre zoneMiniy + 50 et zoneMaxiy - 50
+ var ordonneesPossibles = [];
+ for (var i = zoneMiniy + 50; i < zoneMaxiy - 50; i += 100) {
+ ordonneesPossibles.push(i);
+ }
+ //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
+ 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);
+ rochers.push(rock);
+ }
+ return rochers;
+} //fin generateRandomRock
\ 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.