Code edit (23 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: 'targetX = this.rocherDestination.pushedByHuman.sprite.x; //La cible principale est le buldo allie poussant' Line Number: 685
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: 'TypeError: Cannot read properties of null (reading 'sprite')' in or related to this line: 'targetX = this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le Buldo ordi poussant' Line Number: 667
Code edit (4 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: 'targetX = this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le Buldo ordi poussant' Line Number: 667
Code edit (1 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: 'targetX = this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le Buldo ordi poussant' Line Number: 673
Code edit (7 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: 'targetX = this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le Buldo ordi poussant' Line Number: 673
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'dxHotLeftSpot')' in or related to this line: 'dxHotSpotR = this.rocherrocherDestinationPushed.dxHotLeftSpot; //Le point chaud est le point chaud du rocher' Line Number: 654
Code edit (1 edits merged)
Please save this source code
Code edit (11 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: 'var xTarget = this.rocherDestination.sprite.x - this.camp * this.dxAvHotSpot + this.camp * this.rocherDestination.dxHotLeftSpot; //Abscisse x du point chaud AV du rocher' Line Number: 627
Code edit (10 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: rocher is not defined' in or related to this line: 'this.setLigneHtoR(rocher);' Line Number: 526
Code edit (1 edits merged)
Please save this source code
Code edit (21 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: OrdiZone is not defined' in or related to this line: 'var outRight = this.sprite.x + this.dxHotLeftSpot >= OrdiZone.x; //L'abscisse du point chaud de gauche est superieur a l'abscisse de la zone ordi' Line Number: 377
User prompt
Please fix the bug: 'ReferenceError: scoreOrdiText is not defined' in or related to this line: 'scoreOrdiText.text = mettreAJourScore(scoreOrdiText, scoreOrdi);' Line Number: 781
User prompt
Please fix the bug: 'ReferenceError: scoreHumainText is not defined' in or related to this line: 'scoreHumainText.text = mettreAJourScore(scoreHumainText, scoreHumain);' Line Number: 776
Code edit (1 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: 'buldos[i].sprite = buldorock_sprite;' Line Number: 681
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -345,18 +345,25 @@
buldo.addMoveToStack(typeRotation, sens * 90, 0); //Test rotation Buldo
buldo.addMoveToStack(typeLigneVtoY, 0, y); //Test mouvement Buldo
buldo.addMoveToStack(typeRotation, -sens * 90, 0); //Test rotation Buldo
buldo.addMoveToStack(typeLigneHtoR, this, 0); //Test mouvement Buldo vers le rocher
+ buldo.addMoveToStack(typeRotation, 180, 0); //Test rotation Buldo
+ buldo.addMoveToStack(typeLigneHtoX, buldo.xBase, 0); //Test mouvement Buldo vers sa position de base
+ buldo.addMoveToStack(typeRotation, -180, 0); //Test rotation Buldo
}
}
}; //fin onClickRocherBuldo
this.destroy = function () {
//On previent les eventuels buldos qui poussent le rocher que le rocher est detruit
if (this.pushedByHuman != null) {
this.pushedByHuman.rocherPushed = null;
+ this.pushedByHuman.rocherDestination = null;
+ this.pushedByHuman = null;
}
if (this.pushedByOrdi != null) {
this.pushedByOrdi.rocherPushed = null;
+ this.pushedByOrdi.rocherDestination = null;
+ this.pushedByOrdi = null;
}
//Invisibilite du sprite rocher
this.sprite.visible = false;
}; //fin destroy
@@ -556,28 +563,17 @@
// et on donne à l'abscisse du sprite la valeur qui superpose avec le point destination
var dx = Math.abs(this.xDestination - this.sprite.x);
if (dx < this.vitessePS * delta) {
this.sprite.x = this.xDestination;
- if (this.rocherDestination != null && !this.isPushing) {
- this.isPushing = true; // on indique que le Buldo est en train de pousser un rocher
- this.rocherPushed = this.rocherDestination; // on indique le rocher pousse par le Buldo
- this.rocherPushed.totalPushers += this.camp; // on indique le Buldo qui pousse le rocher
- this.rocherDestination.isBeingPushed = true; // on indique que le rocher est pousse par un Buldo
- this.rocherDestination.pushedByHuman = this; // on indique le Buldo qui pousse le rocher
- }
+ this.isMovingH = false; //Fin du mouvement H simple
return;
} else {
// Sinon on déplace le sprite horizontalement
// Déplacement du sprite
this.sprite.x += this.vitesseEnCours * delta;
return;
}
}
- if (this.rocherDestination == this.rocherPushed) {
- this.isMovingH = true; // on indique que le Buldo n'est plus en train de pousser un rocher
- } else {
- this.isMovingH = false; // on indique que le Buldo n'est plus en train de pousser un rocher
- }
}; // fin deplaceHtoX
this.setLigneVtoY = function (y) {
this.isMovingV = true; //on indique que le Buldo est en mouvement
this.yDestination = y; //le point d'ancrage doit s'arreter sur y
@@ -613,20 +609,35 @@
}; //fin setLigneHtoR
this.deplaceHtoR = function (delta) {
// Vérifie si le Buldo est en mouvement
if (this.isMovingR) {
- var AD = dist(this.sprite.x, 0, this.rocherDestination.sprite.x, 0);
+ if (this.rocherDestination && this.rocherDestination.sprite) {
+ var xTarget = this.rocherDestination.sprite.x - this.camp * this.dxAvHotSpot + this.camp * this.rocherDestination.dxHotLeftSpot; //Abscisse x du point chaud AV du rocher
+ } else {
+ return; // Exit the function if rocherDestination or its sprite is null
+ }
+ var AD = dist(this.sprite.x, 0, xTarget, 0); //Distance entre l'abscisse du sprite et l'abscisse x destination
if (AD <= Math.abs(this.vitesseEnCours * delta)) {
// Si la distance entre l'abscisse du sprite et l'abscisse x destination est inférieure à la vitesse en cours, on arrête le déplacement
- this.sprite.x = this.rocherDestination.sprite.x; // on donne à l'abscisse du sprite la valeur x destination
- this.isMovingR = false; // on indique que le Buldo n'est plus en mouvement
- return;
+ this.sprite.x = xTarget; // on donne à l'abscisse du sprite la valeur x destination
+ if (this.rocherDestination != null && !this.isPushing) {
+ this.isPushing = true; // on indique que le Buldo est en train de pousser un rocher
+ this.rocherPushed = this.rocherDestination; // on indique le rocher pousse par le Buldo
+ this.rocherPushed.totalPushers += this.camp; // on indique le Buldo qui pousse le rocher
+ this.rocherDestination.isBeingPushed = true; // on indique que le rocher est pousse par un Buldo
+ this.rocherDestination.pushedByHuman = this; // on indique le Buldo qui pousse le rocher
+ }
} else {
// Sinon on déplace le sprite horizontalement
this.sprite.x += this.vitesseEnCours * delta;
- return;
}
}
+ 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
+ }
+ return;
}; // fin deplaceHtoR
}); //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.