User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'scaleX' in undefined' in or related to this line: 'tween(self.currentGraphic, {' Line Number: 224 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'scaleX' in undefined' in or related to this line: 'tween(self.currentGraphic, {' Line Number: 224 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'scaleX' in undefined' in or related to this line: 'tween(self.currentGraphic, {' Line Number: 224 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: Cannot use 'in' operator to search for 'scaleX' in undefined' in or related to this line: 'tween(self.currentGraphic, {' Line Number: 224 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(self.currentGraphic, {' Line Number: 216 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'heartType')' in or related to this line: 'projectionsManager.popHearts(self.currentGraphic.heartType);' Line Number: 205
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'index')' in or related to this line: 'log("Current indexes:: ", self.currentGraphic.index, ',', self.nextGraphic.index); // Log the tap count' Line Number: 195
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: Cannot read properties of undefined (reading 'alpha')' in or related to this line: 'log("Alpha progress:", alphaProgress, "Current alpha:", self.currentGraphic.alpha, "Next alpha:", self.nextGraphic.alpha);' Line Number: 291
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'alpha')' in or related to this line: 'self.currentGraphic.alpha = 1 - alphaProgress;' Line Number: 287
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: undefined is not an object (evaluating 'self.currentGraphic.scaleX = 1.1')' in or related to this line: 'self.currentGraphic.scaleX = 1.1;' Line Number: 276
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: undefined is not an object (evaluating 'self.currentGraphic.scaleX = 1.1')' in or related to this line: 'self.currentGraphic.scaleX = 1.1;' Line Number: 276
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'scaleX')' in or related to this line: 'self.currentGraphic.scaleX = 1.1;' Line Number: 268
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'scaleX')' in or related to this line: 'self.currentGraphic.scaleX = 1.1;' Line Number: 270
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'visible')' in or related to this line: 'self.currentGraphic.visible = true;' Line Number: 263
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'visible')' in or related to this line: 'self.currentGraphic.visible = true;' Line Number: 261
User prompt
Please fix the bug: 'Timeout.tick error: Cannot set properties of undefined (setting 'visible')' in or related to this line: 'self.currentGraphic.visible = true;' Line Number: 257
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: 'Script error.' in or related to this line: 'throw new Error("Generator with id ".concat(generatorId, " not found"));' Line Number: 684
Code edit (1 edits merged)
Please save this source code
User prompt
move global animateHeart() function code inside of BigHeart.animateHeartGraphics() function
User prompt
now move animateHeart code inside BigHeart.animateHeartGraphics() function
===================================================================
--- original.js
+++ change.js
@@ -94,55 +94,21 @@
var baseWidth = bigHeartGraphics.width;
var baseHeight = bigHeartGraphics.height;
// Event handler called when a press happens on element. This is automatically called on press if bigHeart is attached.
self.down = function (x, y, obj) {
- self.animateHeartGraphics();
+ // Log the down event
+ log("Down event triggered on BigHeart");
log("Current indexes:: ", self.currentGraphic.index, ',', self.nextGraphic.index); // Log the tap count
// Increment tap counter
progressManager.manualGeneration();
+ self.animateBeat();
+ self.animateFrames();
// Create a new heart projection using the current frame index
projectionsManager.popHearts(self.currentGraphic.heartType);
- updateTapCountText(); // Update the text display
- // Switch graphics based on tapCount
- var frameIndex = 5 - Math.floor(tapCount / self.nbTapsPerFrame);
- // CONTINUER ICI : EXTRACT EXPLOSION LOGIC FOR GENERATOR TO TRIGGER EXPLOSION
- // CONTINUER ICI : EXTRACT EXPLOSION LOGIC FOR GENERATOR TO TRIGGER EXPLOSION
- // CONTINUER ICI : EXTRACT EXPLOSION LOGIC FOR GENERATOR TO TRIGGER EXPLOSION
- // CONTINUER ICI : EXTRACT EXPLOSION LOGIC FOR GENERATOR TO TRIGGER EXPLOSION
- // CONTINUER ICI : EXTRACT EXPLOSION LOGIC FOR GENERATOR TO TRIGGER EXPLOSION
- if (!self.explosionTriggered && tapCount < self.tapLimit * (self.heartType + 1) && frameIndex > 0) {
- self.currentGraphic = self.heartFrames[self.heartType][frameIndex];
- self.nextGraphic = self.heartFrames[self.heartType][frameIndex - 1];
- self.currentGraphic.visible = true;
- self.nextGraphic.visible = true;
- tween(self.currentGraphic, {
- scaleX: 1.1,
- scaleY: 1.1
- }, {
- duration: 300,
- easing: tween.easeOut
- });
- // Make next frame bigger
- tween(self.nextGraphic, {
- scaleX: 1.1,
- scaleY: 1.1
- }, {
- duration: 300,
- easing: tween.easeOut
- });
- } else if (tapCount >= self.tapLimit * (self.heartType + 1)) {
- log("Tap count: ", tapCount); // Log the tap count
- // Explosion
- self.triggerExplosion();
- }
- log("Tap count: ", tapCount); // Log the tap count
- self.currentGraphic.alpha = Math.max(0, Math.min(1, 1 - ((self.heartType + 1) * self.tapLimit - tapCount) / 10));
- // Log the down event
- log("Down event triggered on BigHeart");
shakeMiddleground();
};
// Beat Animation
- self.animateHeartGraphics = function () {
+ self.animateBeat = function () {
// Play beat sound
LK.getSound('bump').play();
tween(self.currentGraphic, {
scaleX: 1.2,
@@ -178,11 +144,46 @@
}
});
}
};
+ // Frames Animation
+ self.animateFrames = function () {
+ // Switch graphics based on tapCount
+ var frameIndex = 5 - Math.floor(tapCount / self.nbTapsPerFrame);
+ if (!self.explosionTriggered && tapCount < self.tapLimit * (self.heartType + 1) && frameIndex > 0) {
+ self.currentGraphic = self.heartFrames[self.heartType][frameIndex];
+ self.nextGraphic = self.heartFrames[self.heartType][frameIndex - 1];
+ self.currentGraphic.visible = true;
+ self.nextGraphic.visible = true;
+ tween(self.currentGraphic, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 300,
+ easing: tween.easeOut
+ });
+ // Make next frame bigger
+ tween(self.nextGraphic, {
+ scaleX: 1.1,
+ scaleY: 1.1
+ }, {
+ duration: 300,
+ easing: tween.easeOut
+ });
+ }
+ // 10 taps | 5 frames => 10%5
+ //self.currentGraphic.alpha = Math.max(0, Math.min(1, 1 - ((self.heartType + 1) * self.tapLimit - tapCount) / 10));
+ // Calculate alpha based on progress percentage within current heart level
+ var currentLevelTaps = (self.heartType + 1) * self.tapLimit;
+ var previousLevelTaps = self.heartType * self.tapLimit;
+ var progressInLevel = (tapCount - previousLevelTaps) / (currentLevelTaps - previousLevelTaps);
+ self.nextGraphic.alpha = 1 - Math.max(0, Math.min(1, progressInLevel));
+ log("progressInLevel:", progressInLevel, " => aplha=", self.currentGraphic.alpha);
+ };
// Explosion Animation
- self.triggerExplosion = function () {
+ self.animateExplosion = function () {
if (!self.explosionTriggered) {
+ self.explosionTriggered = true;
LK.getSound('boom').play();
LK.setTimeout(function () {
LK.effects.flashScreen(0xffffff, 1000); // Flash the screen white for 500ms
background.changeBackground((self.heartType + 1) % 10);
@@ -232,9 +233,8 @@
duration: 300,
easing: tween.easeOut
});
}, 205);
- self.explosionTriggered = true;
}
};
});
var GeneratorButton = Container.expand(function (index) {
@@ -569,8 +569,22 @@
self.generators = {};
self.generatorCounts = {}; // Add a counter for each generator
self.upgrades = {};
self.currentTime = Date.now();
+ self.currentLevel = 0;
+ //self.nextLevelLimit = 10;
+ self.tapsPerLevel = {
+ 0: 10,
+ 1: 100,
+ 2: 1000,
+ 3: 10000,
+ 4: 100000,
+ 5: 1000000,
+ 6: 10000000,
+ 7: 100000000,
+ 8: 1000000000,
+ 9: 10000000000
+ };
self.lastUpdateTime = self.currentTime;
self.updateGame = function () {
log("ProgressManager updateGame...");
var now = Date.now();
@@ -583,19 +597,32 @@
tempGenerated += Math.ceil(generated);
});
self.money += tempGenerated;
if (tempGenerated > 0) {
- bigHeart.animateHeartGraphics();
+ bigHeart.animateBeat();
}
tapCount = self.money; // Update tapCount to reflect the current money
updateTapCountText(); // Update the text display
+ log("Tap count: ", tapCount); // Log the tap count
+ self.checkProgress(); // Check the progress
self.lastUpdateTime = now;
};
self.manualGeneration = function () {
tapCount++;
self.money++;
+ log("manualGeneration Tap count: ", tapCount); // Log the tap count
updateTapCountText(); // Update the text display
};
+ self.checkProgress = function () {
+ //if (tapCount >= self.nextLevelLimit * (self.currentLevel + 1)) {
+ if (tapCount >= self.tapsPerLevel[self.currentLevel]) {
+ self.currentLevel++;
+ bigHeart.heartType = self.currentLevel;
+ bigHeart.animateFrames();
+ // Explosion
+ bigHeart.animateExplosion();
+ }
+ };
self.buyGenerator = function (generatorId) {
var generatorConfig = Object.values(GENERATORS).find(function (g) {
return g.id === generatorId;
});
a big lovely heart
a big stone heart
a big used copper heart
face view of a big bronze heart
face view of a big silver heart
Big shining gold heart verly slightly ornate. face view.
Big precious shiny porcelain heart slightly ornate. face view.
Large precious heart in mother-of-pearl, lightly ornate. Front view.
Large heart in precious ruby, very lightly decorated. Front view.
The most precious large heart in diamond, Front view.
clean pink enamel board witha very thin border