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
User prompt
Please fix the bug: 'ReferenceError: nbTicksSinceEndOfWave is not defined' in or related to this line: 'nbTicksSinceEndOfWave -= 1; //On attend un peu avant de passer à la vague suivante' Line Number: 738
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 (2 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: 'monkeyAsset = self.attachAsset(newAssetId, {' Line Number: 95
Code edit (5 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: 'monkeyAsset = self.attachAsset(newAssetId, {' Line Number: 95
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: ticksBeforeNextPosition is not defined' in or related to this line: 'scoreTest = "actualPIx: " + self.actualPositionIndex + " goalPIx: " + self.goalPositionIndex + " assetsToUse: " + self.assetsToUse + " seqIxToUse: " + self.sequenceIndexToUse + "\nticksBeforeNextPosition: " + ticksBeforeNextPosition;' Line Number: 114
Code edit (1 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: '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: 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
===================================================================
--- original.js
+++ change.js
@@ -61,21 +61,25 @@
}
self.coconutChoosen = coconut;
self.goalPositionIndex = checkIndexPosition(coconut);
self.actualPositionIndex = checkIndexPosition(self);
+ scoreTest = "actualPositionIndex: " + self.actualPositionIndex + " goalPositionIndex: " + self.goalPositionIndex;
}; //fin setMoveToGoalPosition
// Function to change the asset
self.changeAsset = function (newAssetId, options) {
- // Remove the existing asset
- self.removeChild(monkeyAsset);
- monkeyAsset.destroy();
+ if (monkeyAsset) {
+ // Remove the existing asset
+ self.removeChild(monkeyAsset);
+ monkeyAsset.destroy();
+ }
// Attach the new asset
monkeyAsset = self.attachAsset(newAssetId, {
anchorX: options && options.anchorX !== undefined ? options.anchorX : 0.5,
anchorY: options && options.anchorY !== undefined ? options.anchorY : 0.5
});
};
self.update = function () {
+ //scoreTest = "actualPositionIndex: " + self.actualPositionIndex + " goalPositionIndex: " + self.goalPositionIndex + " isMoving: " + self.isMoving;
if (!self.isMoving && self.actualPositionIndex != self.goalPositionIndex) {
if (self.actualPosition < self.goalPosition) {
self.isGoingToRight = true;
self.isGoingToLeft = false;
@@ -87,8 +91,9 @@
}
self.sequenceIndexToUse = Math.abs(self.actualPositionIndex - self.goalPositionIndex) == 1 ? self.sequenceIndexToCenter : self.sequenceIndexToExtreme;
self.ticksBeforeNextPosition = self.ticksToGoToGoalPosition / self.sequenceIndexToUse.length;
self.isMoving = true;
+ //scoreTest = "actualPositionIndex: " + self.actualPositionIndex + " goalPositionIndex: " + self.goalPositionIndex + " ticksToGoToGoalPosition: " + self.ticksToGoToGoalPosition + " ticksBeforeNextPosition: " + self.ticksBeforeNextPosition;
} else if (self.isMoving) {
if (self.isGoingToRight) {
if (self.ticksBeforeNextPosition <= 0) {
self.changeAsset(self.assetsToUse[self.sequenceIndexToUse[self.sequenceIndex]]);
@@ -114,9 +119,9 @@
self.sequenceIndex = 0;
self.assetsToUse = [];
self.sequenceIndexToUse = [];
if (self.coconutChoosen) {
- self.coconutChoosen.trajectory.isStarted = true;
+ self.coconutChoosen.trajectory.isStarted = true; //On lache la coconut
self.coconutChoosen = null;
}
}
}; //fin update
@@ -445,9 +450,9 @@
function chooseNextCoconut() {
var randomIndex = Math.floor(Math.random() * coconutsInTree.length);
var newCoconut = coconutsInTree[randomIndex];
coconutsInTree.splice(randomIndex, 1);
- moveMonkeyToCoconut(newCoconut);
+ //moveMonkeyToCoconut(newCoconut);
var typeTrajectory = 0; //Trajectoire linéaire
var X1 = newCoconut.x;
var X2 = X1;
var Y0 = groundLevel;