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
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
===================================================================
--- original.js
+++ change.js
@@ -61,17 +61,15 @@
}
self.coconutChoosen = coconut;
self.goalPositionIndex = checkIndexPosition(coconut);
self.actualPositionIndex = checkIndexPosition(self);
- scoreTest = "actualPositionIndex: " + self.actualPositionIndex + " goalPositionIndex: " + self.goalPositionIndex;
+ //scoreTest = "actualPositionIndex: " + self.actualPositionIndex + " goalPositionIndex: " + self.goalPositionIndex;
}; //fin setMoveToGoalPosition
// Function to change the asset
self.changeAsset = function (newAssetId, options) {
- if (monkeyAsset && newAssetId && typeof newAssetId === 'string' && newAssetId.length > 0) {
- // Remove the existing asset
- self.removeChild(monkeyAsset);
- monkeyAsset.destroy();
- }
+ // 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
@@ -90,10 +88,10 @@
self.assetsToUse = self.assetsToLeft;
}
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;
+ //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]]);
@@ -226,11 +224,8 @@
/****
* Game Code
****/
/****
-* Game zones and backgrounds
-****/
-/****
* GAME DESCRIPTION:
* Game Principle:
* NAME: COCO MONKEY V1.0 by Dalhem 2024
* -There is beach where people are enjoying the sun by the shadow of palm trees.
@@ -274,8 +269,11 @@
* The left zone: the coconut will bounce to the extrem left.
* The center zone: the coconut will randomly bounce to the left or to the right.
* The right zone: the coconut will bounce to the extrem right.
****/
+/****
+* Game zones and backgrounds
+****/
var ScoreZone = {
x: 0,
y: 0,
width: game.width,