User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'pushedByOrdi')' in or related to this line: 'if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {' Line Number: 655
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'pushedByHuman')' in or related to this line: 'if (this.rocherPushed.pushedByHuman == null && this.rocherPushed.pushedByOrdi == null) {' Line Number: 641
Code edit (8 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'pushedByOrdi')' in or related to this line: 'if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {' Line Number: 649
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'pushedByOrdi')' in or related to this line: 'if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {' Line Number: 649
Code edit (8 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: 664
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: 664
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.pushedByHuman.sprite.x; //La cible principale est le buldo allie poussant' Line Number: 685
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
===================================================================
--- original.js
+++ change.js
@@ -346,9 +346,9 @@
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(typeLigneHtoX, buldo.xBase + buldo.camp * buldo.dxAvHotSpot, 0); //Test mouvement Buldo vers la position de base
buldo.addMoveToStack(typeRotation, -180, 0); //Test rotation Buldo
}
}
}; //fin onClickRocherBuldo
@@ -608,8 +608,98 @@
this.rocherDestination = rocher; //le point d'ancrage doit s'arreter sur le rocher
//Calcul du sens du deplacement horizontale : 1=droite, -1=gauche
this.vitesseEnCours = this.sprite.x < rocher.sprite.x ? this.vitessePS : -this.vitessePS; //on donne le sens du deplacement horizontal
}; //fin setLigneHtoR
+ this.checkPusher = function () {
+ //Choix de la cible : point chaud du rocher ou point chaud arriere du Buldo allie poussant
+ var targetX = this.rocherDestination.sprite.x; //Cible principale par defaut
+ var dxHotSpotR = this.camp == humanCamp ? this.rocherDestination.dxHotLeftSpot : this.rocherDestination.dxHotRightSpot; //Point chaud du rocher par defaut
+ switch (this.rocherDestination.totalPushers) {
+ case 0:
+ //Deux cas possibles : zero pousseur ou un pousseur de chaque cote
+ if (this.rocherDestination.pushedByHuman == null && this.rocherDestination.pushedByOrdi == null) {
+ break;
+ } //On ne fait rien, on cible le point chaud du rocher par defaut
+ else if (this.rocherDestination.pushedByHuman == this || this.rocherDestination.pushedByOrdi == this) {
+ break;
+ } //On ne fait rien, on cible le point chaud du rocher par defaut
+ else if (this.rocherDestination.pushedByHuman != null && this.rocherDestination.pushedByOrdi != null) {
+ //Si un Buldo de chaque cote
+ targetX = this.camp == humanCamp ? this.rocherDestination.pushedByHuman.sprite.x : this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le Buldo allie poussant
+ dxHotSpotR = this.camp == humanCamp ? this.rocherDestination.pushedByHuman.dxBkHotSpot : this.rocherDestination.pushedByOrdi.dxBkHotSpot; //Le point chaud est l'arriere du Buldo allie poussant
+ }
+ break;
+ case 1:
+ //Un pousseur cote humain ou bien deux pousseurs humains et un seul pousseur ordi
+ if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {
+ //Si le Buldo poussant le rocher est un Buldo humain mais pas this
+ targetX = this.rocherDestination.pushedByHuman.sprite.x; //La cible principale est le Buldo humain poussant
+ dxHotSpotR = this.rocherDestination.pushedByHuman.dxBkHotSpot; //Le point chaud est l'arriere du Buldo humain poussant
+ } else if (this.camp == humanCamp && this.rocherDestination.pushedByHuman == this) {
+ //Si le Buldo poussant le rocher est this
+ targetX = this.rocherDestination.sprite.x; //La cible principale est le rocher
+ dxHotSpotR = this.rocherDestination.dxHotLeftSpot; //Le point chaud est le point chaud du rocher
+ } else if (this.camp == ordiCamp && this.rocherDestination.pushedByOrdi == null) {
+ //Si il n'y a pas encore de Buldo ordi poussant le rocher
+ targetX = this.rocherDestination.sprite.x; //La cible principale est le rocher
+ dxHotSpotR = this.rocherDestination.dxHotRightSpot; //Le point chaud est le point chaud du rocher
+ } else if (this.camp == ordiCamp && this.rocherPushed.pushedByOrdi == this) {
+ //Si le Buldo poussant le rocher est this
+ targetX = this.rocherPushed.sprite.x; //La cible principale est le rocher
+ dxHotSpotR = this.rocherPushed.dxHotRightSpot; //Le point chaud est le point chaud du rocher
+ } else if (this.camp == ordiCamp && this.rocherDestination.pushedByOrdi != this) {
+ //Si le Buldo poussant le rocher est un autre Buldo ordi
+ targetX = this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le Buldo ordi poussant
+ dxHotSpotR = this.rocherDestination.pushedByOrdi.dxBkHotSpot; //Le point chaud est l'arriere du Buldo ordi poussant
+ }
+ break;
+ case -1:
+ //Un pousseur cote ordi ou bien deux pousseurs ordi et un seul pousseur humain
+ if (this.camp == ordiCamp && this.rocherDestination.pushedByOrdi != this) {
+ //Si le Buldo poussant le rocher est un Buldo ordi mais pas this
+ targetX = this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le Buldo ordi poussant
+ dxHotSpotR = this.rocherDestination.pushedByOrdi.dxBkHotSpot; //Le point chaud est l'arriere du Buldo ordi poussant
+ } else if (this.camp == ordiCamp && this.rocherDestination.pushedByOrdi == this) {
+ //Si le Buldo poussant le rocher est this
+ targetX = this.rocherDestination.sprite.x; //La cible principale est le rocher
+ dxHotSpotR = this.rocherDestination.dxHotRightSpot; //Le point chaud est le point chaud du rocher
+ } else if (this.camp == humanCamp && this.rocherDestination.pushedByHuman == null) {
+ //Si il n'y a pas encore de Buldo humain poussant le rocher
+ targetX = this.rocherDestination.sprite.x; //La cible principale est le rocher
+ dxHotSpotR = this.rocherDestination.dxHotLeftSpot; //Le point chaud est le point chaud du rocher
+ } else if (this.camp == humanCamp && this.rocherDestination.pushedByHuman == this) {
+ //Si le Buldo poussant le rocher est deja this
+ targetX = this.rocherDestination.sprite.x; //La cible principale est le rocher
+ dxHotSpotR = this.rocherDestination.dxHotLeftSpot; //Le point chaud est le point chaud du rocher
+ } else if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {
+ //Si le Buldo poussant le rocher est un autre Buldo humain
+ targetX = this.rocherDestination.pushedByHuman.sprite.x; //La cible principale est le Buldo humain poussant
+ dxHotSpotR = this.rocherDestination.pushedByHuman.dxBkHotSpot; //Le point chaud est l'arriere du Buldo humain poussant
+ }
+ break;
+ case 2:
+ //Deux pousseurs humains : on cible le point chaud du rocher si on est le pousseur principal, sinon on cible le point chaud arriere du Buldo allie poussant
+ if (this.camp == humanCamp && this.rocherDestination.pushedByHuman != this) {
+ //Si le Buldo poussant est un autre Buldo humain
+ targetX = this.rocherDestination.pushedByHuman.sprite.x; //La cible principale est le buldo allie poussant
+ dxHotSpotR = this.rocherDestination.pushedByHuman.dxBkHotSpot; //Le point chaud est l'arriere du Buldo allie poussant
+ }
+ break;
+ case -2:
+ //Deux pousseurs ordi : on cible le point chaud du rocher si on est le pousseur principal, sinon on cible le point chaud arriere du Buldo allie poussant
+ if (this.camp == ordiCamp && this.rocherDestination.pushedByOrdi != this) {
+ //Si le Buldo poussant est un autre Buldo ordi
+ targetX = this.rocherDestination.pushedByOrdi.sprite.x; //La cible principale est le buldo allie poussant
+ dxHotSpotR = this.rocherDestination.pushedByOrdi.dxBkHotSpot; //Le point chaud est l'arriere du Buldo allie poussant
+ }
+ break;
+ default:
+ //Cas impossible pour l'instant car on ne peut pas avoir plus de deux pousseurs du meme camp
+ break;
+ //On ne fait rien, on cible le point chaud du rocher par defaut
+ }
+ return targetX + dxHotSpotR;
+ }; //fin checkPusher
this.deplaceHtoR = function (delta) {
// Vérifie si le Buldo est en mouvement
if (this.rocherDestination != null || this.rocherPushed != null) {
this.isMovingR = true; // on indique que le Buldo est en mouvement
@@ -618,9 +708,9 @@
return;
}
if (this.isMovingR) {
if (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
+ var xTarget = this.checkPusher(); //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
}
var AD = dist(this.sprite.x, 0, xTarget, 0); //Distance entre l'abscisse du sprite et l'abscisse x destination
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.