User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'monkeyAsset = self.attachAsset(newAssetId, {' Line Number: 96
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'monkeyAsset = self.attachAsset(newAssetId, {' Line Number: 96
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'length')' in or related to this line: 'monkeyAsset = self.attachAsset(newAssetId, {' Line Number: 94
Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of null (reading 'trajectory')' in or related to this line: 'coconutChoosen.trajectory.isStarted = true;' Line Number: 138
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 undefined (reading 'anchorX')' in or related to this line: 'monkeyAsset = self.attachAsset(newAssetId, {' Line Number: 69
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot set properties of undefined (setting 'anchorX')' in or related to this line: 'monkey.monkeyAsset.anchorX = 0.91;' Line Number: 421
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: initialAsset is not defined' in or related to this line: 'self.removeChild(initialAsset);' Line Number: 66
Code edit (1 edits merged)
Please save this source code
Code edit (8 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: 'monkey.sprite.x = 2048 / 2;' Line Number: 246
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: oconutsInTree is not defined' in or related to this line: 'oconutsInTree.push(newCoconut);' Line Number: 338
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (19 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -63,9 +63,9 @@
var trajectoryGraphics = self.attachAsset('trajectory', {
anchorX: 0.5,
anchorY: 0.5
});
- self.typeTrajectory = 0; //0: linear, 1: parabolic
+ self.typeTrajectory = 0; //-1: static, 0: linear, 1: parabolic
self.X1 = 0;
self.X2 = 0;
self.Y0 = 0;
self.Yh = 0;
@@ -211,9 +211,9 @@
parasol.x = 2048 / 2;
parasol.y = OptionsZone.y - 400;
var coconutsInTree = []; //Tableau des coconuts dans les arbres
var coconuts = []; //Tableau des coconuts en mouvement
-var nombreCoconuts = 15; //Nombre de coconuts en mouvement en même temps
+var nombreCoconuts = 1; //Nombre de coconuts en mouvement en même temps
var sommetParaboleHaute = ScoreZone.height + 200;
var sommetParaboleBasse = ScoreZone.height + 400;
var nbTicksToBounceHight = 500;
var nbTicksTobounceLow = 500;
@@ -225,9 +225,9 @@
var groundLevel = OptionsZone.y - 300;
/****
* Init game
* ***/
-setBackGroundImage('backGroundBeach', 0, 0, game.width, game.height);
+//setBackGroundImage('backGroundBeach', 0, 0, game.width, game.height);
setCocoInTree();
/****
* Score
****/
@@ -316,14 +316,18 @@
var randomIndex = Math.floor(Math.random() * startPoints.length);
var randomDeltaX = Math.floor(Math.random() * 100) - 50;
var randomDeltaY = Math.floor(Math.random() * 100) - 50;
var typeTrajectory = -1;
- newCoconut.isFalling = false;
- newCoconut.x = startPoints[randomIndex] + randomDeltaX;
- newCoconut.y = monkeyLevel + randomDeltaY;
+ newCoconut.x = 1536; //startPoints[randomIndex]; // + randomDeltaX;
+ newCoconut.y = 200; //monkeyLevel; // + randomDeltaY;
+ scoreTest = "x= " + newCoconut.x + " y= " + newCoconut.y;
coconutsInTree.push(newCoconut);
game.addChild(newCoconut);
}
+ //Affiche les coconuts dans les arbres
+ for (var i = 0; i < coconutsInTree.length; i++) {
+ //game.addChild(coconutsInTree[i]);
+ }
} //fin setCocoInTree
//Fonction chooseNextStartPoint: choisit aléatoirement un point de départ d'un coconut
//Renvoie un objet Coconut
function chooseNextStartPoint() {
@@ -354,9 +358,8 @@
function checkPosition(parasol) {
var deltaX = Math.abs(parasol.x - XL);
var deltaY = Math.abs(parasol.x - XC);
var deltaZ = Math.abs(parasol.x - XR);
- scoreTest = " deltaX = " + deltaX + " deltaY = " + deltaY + " deltaZ = " + deltaZ + " parasol.x = " + parasol.x + " parasol.width = " + parasol.width;
var Xreturn = -1;
if (deltaX <= parasol.width / 2) {
Xreturn = XL;
}
@@ -365,9 +368,8 @@
}
if (deltaZ <= parasol.width / 2) {
Xreturn = XR;
}
- scoreTest += " Xret = " + Xreturn;
return Xreturn;
} //fin checkPosition
//Fonction zoneIntersectParasol: renvoie la zone du parasol qui intersecte le coconut (0 : zone de gauche, 1 : zone centrale de gauche, 2 : zone centrale de droite, 3 : zone de droite)
//Sachant que l'ancrage du parasol est en (0.5, 0.5) et que l'ancrage du coconut est en (0.5, 0.5)