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
@@ -267,9 +267,10 @@
var nbTicksTobounceLow = 220; //Nombre de ticks pour effectuer une parabole basse
var nbTicksToFall = 200; //Nombre de ticks pour tomber
var nbTicksBeforeThrow = 120;
var nbTicksLeftBeforeNextThrow = 0;
-var nbTicksBetweenTwoWaves = 240;
+var nbTicksLessBeforeThrowEachWave = 2;
+var nbTicksBetweenTwoWaves = 200;
var nbTicksSinceEndOfWave = nbTicksBetweenTwoWaves;
var score = 0;
var scoreLast = score;
var scoreTest = 0;
@@ -285,8 +286,10 @@
/****
* Score
****/
var livesLeft = 3; //Nombre de vies restantes
+var pointsToGetNewLife = 400;
+var maxLives = 10;
var livesLeftGraphics = []; //Tableau des sprites 'life' représentant les vies restantes
var scoreTestText = new Text2('0', {
size: 30,
fill: "#000000",
@@ -300,8 +303,18 @@
anchorX: 0.5,
anchorY: 0
});
LK.gui.top.addChild(scoreTxt);
+var waveText = new Text2('Wave ' + wave, {
+ //Affiche le numéro de la vague
+ x: game.width - 100,
+ y: 50,
+ size: 50,
+ fill: "#000000",
+ anchorX: 1,
+ anchorY: 0
+});
+game.addChild(waveText);
game.down = function (x, y, obj) {
parasol.x = x;
parasol.y = parasolLevel;
};
@@ -327,8 +340,12 @@
} //fin updateScoreTest
function updateScore(nouveauScore) {
scoreTxt.setText(nouveauScore);
} //fin updateScore
+//Fonction displayWaveNumber: affiche le numéro de la vague en haut à droite
+function displayWaveNumber(wave) {
+ waveText.setText('WAVE ' + wave);
+} //fin displayWaveNumber
function setLivesLeft() {
//Affiche le nombre de vies restantes (sprite 'life' ) dans le coin supérieur gauche
//Commence par effacer les vies restantes s'il y en a
if (livesLeft != livesLeftGraphics.length) {
@@ -345,11 +362,11 @@
for (var i = livesLeftGraphics.length; i < livesLeft; i++) {
var lifeGraphics = LK.getAsset('life', {
anchorX: 0.5,
anchorY: 0,
- scaleX: 4 - livesLeft,
- scaleY: 4 - livesLeft,
- x: ScoreZone.x + 100 + 100 * i,
+ scaleX: 1,
+ scaleY: 1,
+ x: ScoreZone.x + 100 + 50 * i,
y: ScoreZone.y + 50
});
livesLeftGraphics.push(lifeGraphics);
}
@@ -380,10 +397,10 @@
coconutsInTree.push(newCoconut);
LK.getSound('monkeySquirk').play();
LK.getSound('boomBoom').play();
LK.getSound('boomBoom').play();
- if (nbTicksBetweenTwoWaves >= 12) {
- nbTicksBetweenTwoWaves -= 50; //On accelere le mouvement
+ if (nbTicksBeforeThrow >= 12) {
+ nbTicksBeforeThrow -= nbTicksLessBeforeThrowEachWave; //On accelere le mouvement
}
}
//Affiche les coconuts dans les arbres
for (var i = 0; i < coconutsInTree.length; i++) {
@@ -632,9 +649,9 @@
* Main loop
****/
game.update = function () {
//Mise à jour score
- scoreTest = "nbTicksBeforeThrow: " + nbTicksBeforeThrow + " / nbTicksLeftBeforeNextThrow: " + nbTicksLeftBeforeNextThrow + " / wave: " + wave + " coconuts.length: " + coconuts.length;
+ scoreTest = "WAVE: " + wave;
updateScoreTest(scoreTest);
updateScore(score);
//Vérifier si un coco a touché le sol
for (var i = coconuts.length - 1; i >= 0; i--) {
@@ -643,9 +660,9 @@
coconuts[i].destroy();
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!
+ //letShoutNInsultes(checkIndexPosition(coconuts[i])); //LK bug? : sound doesnt play that way!
if (checkIndexPosition(coconuts[i]) == 1 && livesLeft > 0) {
LK.getSound('sheOuch').play();
placeInsultes(1);
} else if (checkIndexPosition(coconuts[i]) == 2 && livesLeft > 0) {
@@ -676,9 +693,9 @@
if (coconuts[i].intersects(parasol) && coconuts[i].isFalling && deltaX < parasol.width / 2 && isCloseEnough) {
coconuts[i].Xintercept = parasol.x;
coconuts[i].Yintercept = coconuts[i].y;
score += 10;
- if (score - scoreLast >= 1000 && livesLeft < 10) {
+ if (score - scoreLast >= pointsToGetNewLife && livesLeft < maxLives) {
livesLeft += 1; //Bonus de 11 coeur tous les 1000 noix
scoreLast = score;
}
coconuts[i].isFalling = false;
@@ -717,6 +734,7 @@
//Autres actions à effectuer sans urgence
if (LK.ticks % 60 == 0) {
//Afficher les coeurs
setLivesLeft();
+ displayWaveNumber(wave);
}
};
\ No newline at end of file