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
Code edit (4 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -265,9 +265,9 @@
var sommetParaboleBasse = ScoreZone.height + 400;
var nbTicksToBounceHight = 230; //Nombre de ticks pour effectuer une parabole haute
var nbTicksTobounceLow = 220; //Nombre de ticks pour effectuer une parabole basse
var nbTicksToFall = 200; //Nombre de ticks pour tomber
-var nbTicksBeforeThrow = 150;
+var nbTicksBeforeThrow = 24;
var nbTicksLeftBeforeNextThrow = 0;
var score = 0;
var scoreLast = score;
var scoreTest = 0;
@@ -376,9 +376,8 @@
var Yh = Y0;
var totalTicks = 0;
newCoconut.trajectory.setParameters(typeTrajectory, X1, X2, Y0, Yh, totalTicks);
coconutsInTree.push(newCoconut);
- nbTicksBeforeThrow /= wave; //Diminue le nombre de ticks avant le prochain lancer
LK.getSound('monkeySquirk').play();
LK.getSound('boomBoom').play();
LK.getSound('boomBoom').play();
}
@@ -613,8 +612,11 @@
}, 2000);
} //fin placeInsultes
//Fonction letShout: fait crier le personnage designé par l'index de la position
function letShoutNInsultes(index) {
+ if (livesLeft <= 0) {
+ return;
+ }
if (index != 0 && index != 1 && index != 2) {
LK.effects.flashScreen(0xff0000, 1000);
}
var shouts = ['heShout1', 'sheShout', 'heShout2'];
@@ -626,8 +628,9 @@
* Main loop
****/
game.update = function () {
//Mise à jour score
+ scoreTest = "nbTicksBeforeThrow: " + nbTicksBeforeThrow + " / nbTicksLeftBeforeNextThrow: " + nbTicksLeftBeforeNextThrow + " / wave: " + wave + " coconuts.length: " + coconuts.length;
updateScoreTest(scoreTest);
updateScore(score);
//Vérifier si un coco a touché le sol
for (var i = coconuts.length - 1; i >= 0; i--) {
@@ -637,15 +640,15 @@
coconuts.splice(i, 1);
} else if (coconuts[i].y >= groundLevel) {
//Si le coco est tombé au sol
//letShoutNInsultes(checkIndexPosition(coconuts[i])); //Bug : sound doesnt play that way!
- if (checkIndexPosition(coconuts[i]) == 1) {
+ if (checkIndexPosition(coconuts[i]) == 1 && livesLeft > 0) {
LK.getSound('sheOuch').play();
placeInsultes(1);
- } else if (checkIndexPosition(coconuts[i]) == 2) {
+ } else if (checkIndexPosition(coconuts[i]) == 2 && livesLeft > 0) {
LK.getSound('heOuch2').play();
placeInsultes(2);
- } else if (checkIndexPosition(coconuts[i]) == 0) {
+ } else if (checkIndexPosition(coconuts[i]) == 0 && livesLeft > 0) {
LK.getSound('heOuch1').play();
placeInsultes(0);
} else {
LK.effects.flashScreen(0xff0000, 1000);
@@ -682,12 +685,10 @@
coconuts[i].trajectory.isStarted = true;
coconuts[i].isBouncing = true;
}
}
- //Autres actions à effectuer sans urgence
- if (LK.ticks % 60 == 0) {
- //Afficher les coeurs
- setLivesLeft();
+ //Rechargement en cocos
+ if (LK.ticks % (60 / wave) == 0) {
// Récupérer un coconut dans les arbres et le faire tomber si l'heure est venue
if (coconutsInTree.length > 0 && nbTicksLeftBeforeNextThrow <= 0 && livesLeft > 0) {
if (coconutChoosen == null) {
coconutChoosen = chooseNextCoconut();
@@ -696,11 +697,16 @@
nbTicksLeftBeforeNextThrow = nbTicksBeforeThrow;
coconutChoosen = null;
}
} else if (coconutsInTree.length > 0 && nbTicksLeftBeforeNextThrow > 0) {
- nbTicksLeftBeforeNextThrow -= 60;
+ nbTicksLeftBeforeNextThrow -= 1;
} else if (coconutsInTree.length == 0) {
wave += 1;
setCocoInTree(wave);
}
}
+ //Autres actions à effectuer sans urgence
+ if (LK.ticks % 60 == 0) {
+ //Afficher les coeurs
+ setLivesLeft();
+ }
};
\ No newline at end of file