User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'self.tapLimit = TAPS_PER_LEVEL[0]; // Initialize tap limit' Line Number: 141
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'self.tapLimit = TAPS_PER_LEVEL[0]; // Initialize tap limit' Line Number: 141
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'self.tapLimit = TAPS_PER_LEVEL[0]; // Initialize tap limit' Line Number: 141
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'self.tapLimit = TAPS_PER_LEVEL[0]; // Initialize tap limit' Line Number: 141
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading '0')' in or related to this line: 'self.tapLimit = TAPS_PER_LEVEL[0]; // Initialize tap limit' Line Number: 141
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'TAPS_PER_LEVEL')' in or related to this line: 'self.tapLimit = progressManager.TAPS_PER_LEVEL[0]; // Initialize tap limit' Line Number: 141
Code edit (4 edits merged)
Please save this source code
User prompt
extract the tapsPerLevel from progressManager class to a global constant
User prompt
is idDebug, Set debug cost for Generators to respectivly 10, 11 and 12
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'tapsPerLevel')' in or related to this line: 'bigHeart.nbTapsPerFrame = progressManager.tapsPerLevel[0] / 6; // Initialize number of taps per frame based on level 0' Line Number: 1050
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'tapsPerLevel')' in or related to this line: 'self.nbTapsPerFrame = progressManager.tapsPerLevel[0] / 6; // Initialize number of taps per frame based on level 0' Line Number: 141
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'tapsPerLevel')' in or related to this line: 'self.nbTapsPerFrame = progressManager.tapsPerLevel[0] / 6; // Initialize number of taps per frame based on level 0' Line Number: 141
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'tapsPerLevel')' in or related to this line: 'self.nbTapsPerFrame = progressManager.tapsPerLevel[0] / 6; // Initialize number of taps per frame based on level 0' Line Number: 141
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '1')' in or related to this line: 'self.currentGraphic = self.heartFrames[self.heartType][5];' Line Number: 746
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '1')' in or related to this line: 'self.currentGraphic = self.heartFrames[self.heartType][5];' Line Number: 754
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '1')' in or related to this line: 'self.currentGraphic = self.heartFrames[self.heartType][5];' Line Number: 788
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '1')' in or related to this line: 'self.currentGraphic = self.heartFrames[self.heartType][5];' Line Number: 772
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '1')' in or related to this line: 'self.currentGraphic = self.heartFrames[self.heartType][5];' Line Number: 772
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading '1')' in or related to this line: 'self.currentGraphic = self.heartFrames[self.heartType][5];' Line Number: 760
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Background = Container.expand(function () {
var self = Container.call(this);
// Attach the background_1 asset to the class
self.backgrounds = [];
for (var i = 0; i <= 9; i++) {
var background = self.attachAsset('background_' + i, {
anchorX: 0.5,
anchorY: 0.5,
visible: false
});
self.backgrounds.push(background);
}
self.backgrounds[0].visible = true; // Set the initial background visible
// Position the background at the center of the screen
self.x = 2048 / 2;
self.y = 2732 / 2;
// Function to change the background based on the index
self.changeBackground = function (index) {
var currentBg = self.backgrounds.find(function (bg) {
return bg.visible;
});
var newBg = self.backgrounds[index];
if (newBg && currentBg !== newBg) {
tween(currentBg, {
alpha: 0
}, {
duration: 500,
easing: tween.easeOut,
onFinish: function onFinish() {
currentBg.visible = false;
newBg.alpha = 0;
newBg.visible = true;
tween(newBg, {
alpha: 1
}, {
duration: 500,
easing: tween.easeIn
});
}
});
}
};
});
// Create a class for bigHeart
var BigHeart = Container.expand(function () {
var self = Container.call(this);
self.currentGraphic = null;
self.nextGraphic = null;
self.tapLimit = 12; // Initialize tap limit
self.nbTapsPerFrame = self.tapLimit / 6; // Initialize number of taps per frame
self.heartType = 0; // Initialize tap counter
self.explosionTriggered = false; // Initialize explosion flag
// Attach the bigHeart asset to the class
var bigHeartGraphics = self.attachAsset('bigHeart', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.1
});
self.heartFrames = Array.from({
length: 10
}, function (_, type) {
return Array.from({
length: 6
}, function (_, i) {
return self.attachAsset('heart_' + type + '_frame_' + i, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.9,
scaleY: 0.9,
heartType: type,
index: i,
visible: i === 5
});
});
}); // Initialize heartFrames as a 2D array with assets
for (var type = 9; type >= 0; type--) {
self.heartFrames[type] = [];
for (var i = 5; i >= 0; i--) {
self.heartFrames[type][5 - i] = self.attachAsset('heart_' + type + '_frame_' + i, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.9,
scaleY: 0.9,
heartType: type,
index: 5 - i,
visible: !i
});
}
}
log("Setting frames in constructor...");
self.currentGraphic = self.heartFrames[self.heartType][5];
self.nextGraphic = self.heartFrames[self.heartType][4];
if (self.currentGraphic) {
if (self.currentGraphic && self.currentGraphic.scaleX !== undefined) {
self.currentGraphic.scaleX = 1.1;
}
if (self.currentGraphic && self.currentGraphic.scaleY !== undefined) {
self.currentGraphic.scaleY = 1.1;
}
self.currentGraphic.visible = true;
}
if (self.nextGraphic) {
if (self.nextGraphic.scaleX !== undefined) {
self.nextGraphic.scaleX = 1.1;
}
if (self.nextGraphic.scaleY !== undefined) {
self.nextGraphic.scaleY = 1.1;
}
self.nextGraphic.visible = true;
}
// Position the bigHeart at the center of the screen
self.x = 2048 / 2;
self.y = 2732 / 2 - 300;
// Define baseWidth and baseHeight
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) {
// Log the down event
log("Down event triggered on BigHeart");
// First animate the beat to ensure graphics are initialized
self.animateBeat();
// Then increment tap counter
progressManager.manualGeneration();
// Create a new heart projection using the current frame index
if (self.currentGraphic) {
projectionsManager.popHearts(self.currentGraphic.heartType);
} else {
log("CurrentGraphic is not initialized.");
}
shakeMiddleground();
};
self.animateBeat = function () {
// Play beat sound
LK.getSound('bump').play();
if (self.currentGraphic) {
if (!self.currentGraphic._activeTween) {
self.currentGraphic._activeTween = tween(self.currentGraphic, {
scaleX: 1.2,
scaleY: 1.2,
x: 0
}, {
duration: 100,
onFinish: function onFinish() {
if (self.currentGraphic) {
delete self.currentGraphic._activeTween;
tween(self.currentGraphic, {
scaleX: 1.1,
scaleY: 1.1,
x: 0
}, {
duration: 100
});
}
}
});
}
}
if (self.nextGraphic && !self.nextGraphic._activeTween) {
self.nextGraphic._activeTween = tween(self.nextGraphic, {
duration: 250,
onFinish: function onComplete() {
if (self.nextGraphic) {
delete self.nextGraphic._activeTween;
tween(self.nextGraphic, {
scaleX: 1.2,
scaleY: 1.2,
x: 0
}, {
duration: 100,
onFinish: function onFinish() {
if (self.nextGraphic) {
delete self.nextGraphic._activeTween;
tween(self.nextGraphic, {
scaleX: 1.1,
scaleY: 1.1,
x: 0
}, {
duration: 100
});
}
}
});
}
}
});
}
};
self.updateFramesByProgress = function (progress) {
log("=== updateFramesByProgress ===");
log("Raw progress:", progress);
// Progress is already tap count / tapsPerLevel, so we need to scale it to frames
// Each frame gets 20% of progress (0.2 per frame)
var frameProgress = progress * 5; // Convert progress to frame scale (0-5)
log("Progress calculations:");
log("- frameProgress:", frameProgress);
// Hide all frames of current type
self.heartFrames[self.heartType].forEach(function (frame) {
if (frame && frame._activeTween) {
frame._activeTween.stop();
}
frame.visible = false;
});
// Handle the final frame (0) separately - only shown after explosion
if (progress >= 1) {
log("Progress >= 1, showing frame 0");
self.currentGraphic = self.heartFrames[self.heartType][0];
if (self.currentGraphic) {
self.currentGraphic.visible = true;
self.currentGraphic.scaleX = self.currentGraphic.scaleY = 1.1;
self.currentGraphic.alpha = 1;
log("Frame 0 set to visible with alpha:", self.currentGraphic.alpha);
}
self.nextGraphic = null;
return;
}
// Calculate frame indices based on progress
var currentFrameIndex = 5 - Math.floor(frameProgress);
var alpha = 1 - (frameProgress - Math.floor(frameProgress));
log("Frame calculations:");
log("- heartType:", self.heartType);
log("- currentFrameIndex:", currentFrameIndex);
log("- alpha:", alpha);
// Show next frame first (it will be behind current frame)
if (currentFrameIndex > 1) {
// Only show next frame if we're not on frame 1
self.nextGraphic = self.heartFrames[self.heartType][currentFrameIndex - 1];
if (self.nextGraphic) {
self.nextGraphic.visible = true;
self.nextGraphic.alpha = 1; // Keep next frame fully visible
self.nextGraphic.scaleX = self.nextGraphic.scaleY = 1.1;
// Ensure nextGraphic is behind currentGraphic
if (self.nextGraphic.parent) {
//self.nextGraphic.parent.setChildIndex(self.nextGraphic, 0);
}
log("Next frame setup:");
log("- heartType:", self.nextGraphic.heartType);
log("- index:", currentFrameIndex - 1);
log("- visible:", self.nextGraphic.visible);
log("- alpha:", self.nextGraphic.alpha);
log("- scale:", self.nextGraphic.scaleX);
}
} else {
log("No next frame (currentFrameIndex <= 1)");
self.nextGraphic = null;
}
// Show current frame on top
self.currentGraphic = self.heartFrames[self.heartType][currentFrameIndex];
if (self.currentGraphic) {
self.currentGraphic.visible = true;
self.currentGraphic.alpha = alpha; // Only fade out current frame
self.currentGraphic.scaleX = self.currentGraphic.scaleY = 1.1;
// Ensure currentGraphic is above nextGraphic
if (self.currentGraphic.parent) {
//self.currentGraphic.parent.setChildIndex(self.currentGraphic, self.currentGraphic.parent.children.length - 1);
}
log("Current frame setup:");
log("- heartType:", self.currentGraphic.heartType);
log("- index:", currentFrameIndex);
log("- visible:", self.currentGraphic.visible);
log("- alpha:", self.currentGraphic.alpha);
log("- scale:", self.currentGraphic.scaleX);
}
log("=== End updateFramesByProgress ===\n");
};
self.animateExplosion = function (callback) {
if (!self.explosionTriggered) {
self.explosionTriggered = true;
if (true || !isDebug) {
LK.getSound('boom').play();
}
var cloneGraphic;
if (self.nextGraphic) {
cloneGraphic = LK.getAsset('heart_' + self.nextGraphic.heartType + '_frame_' + self.nextGraphic.index, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: self.nextGraphic.scaleX,
scaleY: self.nextGraphic.scaleY,
alpha: 1
});
self.addChild(cloneGraphic);
}
// Update heart type immediately so new frames are ready
if (self.heartType < 9) {
var nextHeartType = self.heartType + 1;
// Pre-scale both frames of the next heart type
tween(self.heartFrames[nextHeartType][5], {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 300,
easing: tween.easeOut
});
tween(self.heartFrames[nextHeartType][4], {
scaleX: 1.1,
scaleY: 1.1
}, {
duration: 300,
easing: tween.easeOut
});
// Initialize graphics for new heart type
self.currentGraphic = self.heartFrames[nextHeartType][5];
self.nextGraphic = self.heartFrames[nextHeartType][4];
// Update heart type and notify projections
self.heartType = nextHeartType;
projectionsManager.updateHeartType(nextHeartType);
}
LK.setTimeout(function () {
LK.effects.flashScreen(0xffffff, 2000); // Flash the screen white
background.changeBackground(progressManager.currentLevel + 1); // Change background when level changes
if (cloneGraphic) {
log("nextGraphic for explosion!", cloneGraphic);
tween(cloneGraphic, {
scaleX: 45,
scaleY: 45,
alpha: 0
}, {
duration: 3000,
easing: tween.easeOut,
onFinish: function onFinish() {
// Make all frames of the previous heart type invisible
self.heartFrames[self.heartType - 1].forEach(function (frame) {
frame.visible = false;
});
// Make current heart type frames visible
if (self.currentGraphic) {
self.currentGraphic.visible = true;
}
if (self.nextGraphic) {
self.nextGraphic.visible = true;
}
self.explosionTriggered = false; // Reset explosion flag
cloneGraphic.destroy(); // Remove the clone after animation
if (callback) {
callback();
}
}
});
} else {
log("No nextGraphic for explosion!");
}
}, 205);
}
};
self.resetGraphics = function () {
log("=== resetGraphics ===");
// Stop current graphic tweens
if (self.currentGraphic && self.currentGraphic._activeTween) {
self.currentGraphic._activeTween.stop();
log("Stopped currentGraphic tween");
}
if (self.nextGraphic && self.nextGraphic._activeTween) {
self.nextGraphic._activeTween.stop();
log("Stopped nextGraphic tween");
}
// Hide only active frames
if (self.currentGraphic) {
self.currentGraphic.visible = false;
log("Set currentGraphic visible to false");
}
if (self.nextGraphic) {
self.nextGraphic.visible = false;
log("Set nextGraphic visible to false");
}
self.currentGraphic = null;
self.nextGraphic = null;
log("Reset currentGraphic and nextGraphic to null");
log("=== End resetGraphics ===\n");
};
});
// Create a class for bigHeart
var GeneratorButton = Container.expand(function (index) {
var self = Container.call(this);
// Attach a button asset to the class
var buttonGraphics = self.attachAsset('generatorButton', {
anchorX: 0.5,
anchorY: 0.5
});
// Ensure rightBoard is initialized before accessing its properties
self.index = Math.min(Math.max(0, index), maxGenerators);
self.isAnimating = false; // Add isAnimating flag at instance level
var generatorAsset = self.attachAsset('generator_' + self.index, {
anchorX: 0.5,
anchorY: 0.5
});
if (typeof GENERATORS !== 'undefined') {
self.config = Object.values(GENERATORS).find(function (g) {
return g.id === self.index;
});
} else {
console.error("GENERATORS is not defined");
self.config = {
cost: 0
}; // Default to prevent undefined error
}
self.costText = new Text2(self.config.cost.toString(), {
size: 50,
fill: 0x043515,
dropShadow: true,
align: 'center'
});
self.countText = new Text2(' ', {
size: 50,
fill: 0x043515,
dropShadow: true,
align: 'center'
});
self.countText.x = -buttonGraphics.width / 2 + 10;
self.countText.y = -buttonGraphics.height / 2 + 10;
self.addChild(self.countText);
self.costText.x = 45;
self.costText.y = 75;
self.visible = false;
self.addChild(self.costText);
if (typeof GENERATORS !== 'undefined') {
self.config = Object.values(GENERATORS).find(function (g) {
return g.id === self.index;
});
} else {
console.error("GENERATORS is not defined");
}
// Position the button at the center of the screen
// self.x = 2048 / 2;
// self.y = 2732 / 2;
// Event handler called when a press happens on the button
var isSwipingButtons = false; // Global flag to track swipe/animation state
var dragNode = null;
var globalStartY = 0;
self.down = function (x, y, obj) {
if (isSwipingButtons) {
return;
} // Prevent interaction during animation
log("Generator button pressed", y);
globalStartY = y;
self.startTime = Date.now();
self.startX = x;
dragNode = rightBoard;
};
self.up = function (x, y, obj) {
if (isSwipingButtons) {
dragNode = null;
return;
}
var endTime = Date.now();
var timeDiff = endTime - self.startTime;
var distance = Math.sqrt(Math.pow(x - self.startX, 2) + Math.pow(y - globalStartY, 2));
if (timeDiff < TAP_DETECT_DELAY && distance < SWIPE_THRESHOLD) {
// Detected as a tap
log("Detected tap on Generator button");
// Check if tapCount is less than the cost of the generator
if (tapCount < self.config.cost) {
log("No enough love");
LK.getSound('cantBuyGenerator').play(); // Play sound when player can't buy
// Store original position
var originalX = self.x;
var originalY = self.y;
isSwipingButtons = true;
dragNode = null; // Reset dragNode immediately when starting animation
tween(self, {
x: originalX + 10,
y: originalY + 10
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (!isSwipingButtons) {
return;
} // Prevent animation continuation if interrupted
tween(self, {
x: originalX - 10,
y: originalY - 10
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
if (!isSwipingButtons) {
return;
}
tween(self, {
x: originalX,
y: originalY
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
isSwipingButtons = false;
}
});
}
});
}
});
return; // Exit if not enough taps
}
// Buy the corresponding generator using progressManager
if (progressManager.buyGenerator(self.index)) {
log("Generator purchased successfully");
tween(self, {
scaleX: 1.2,
// Increase scale for bump effect
scaleY: 1.2
}, {
duration: 100,
// Duration of the bump
easing: tween.easeOut,
// Easing function for smooth effect
onFinish: function onFinish() {
tween(self, {
// Return to original scale
scaleX: 1,
scaleY: 1
}, {
duration: 100,
easing: tween.easeIn
});
}
});
} else {
log("Failed to purchase generator");
}
} else {
// Only handle swipe if not animating
if (!isSwipingButtons && dragNode === rightBoard) {
log("Detected swipe on Generator button");
rightBoard.handleSwipe(y - globalStartY);
}
dragNode = null; // Reset dragNode when mouse is up
}
};
});
var GiftRain = Container.expand(function () {
var self = Container.call(this);
self.giftPool = [];
self.activeGifts = [];
self.generatorCount = 0;
// Initialize gift pool
for (var i = 0; i < 50; i++) {
var gift = new RainDrop();
gift.updateAsset(self.generatorCount);
gift.speed = Math.random() * 2 + 1; // Random speed for each gift
gift.visible = false; // Start invisible
self.addChild(gift); // Add to container immediately
self.giftPool.push(gift);
}
// Function to spawn a gift
self.spawnGift = function (generatorId) {
log("Spawning gift. Active gifts count: ", self.activeGifts.length);
if (self.giftPool.length > 0) {
var gift = self.giftPool.pop();
gift.x = Math.random() * (1948 - 100) + 100;
gift.y = -300; // Start above the screen
gift.rotation = Math.random() * (Math.PI / 2) - Math.PI / 4; // Set random rotation between -PI/4 and +PI/4
gift.alpha = 0.8;
gift.visible = true;
gift.updateAsset(generatorId); // Update asset when spawning
self.activeGifts.push(gift);
log("Gift spawned at position: ", gift.x, gift.y);
}
};
// Update function to move gifts
self.update = function () {
for (var i = self.activeGifts.length - 1; i >= 0; i--) {
var gift = self.activeGifts[i];
gift.y += gift.speed;
if (gift.y > 3000) {
log("Gift moved out of bounds and will be recycled. Position: ", gift.x, gift.y);
gift.x = Math.random() * (1948 - 100) + 100;
gift.y = -300; // Start above the screen
gift.rotation = Math.random() * (Math.PI / 2) - Math.PI / 4; // Set random rotation between -PI/4 and +PI/4
gift.visible = true;
}
}
};
// Function to increase gift spawn rate
self.increaseSpawnRate = function (generatorId) {
self.generatorCount++;
self.spawnGift(generatorId);
log("Increasing spawn rate. Generator count: ", self.generatorCount);
// for (var i = 0; i < self.generatorCount; i++) {
// self.spawnGift(generatorId);
// }
};
});
// Create a class for Projections
var Projections = Container.expand(function () {
var self = Container.call(this);
var nbProjections = 5;
var heartSpeed = 20;
var gravity = 0.5;
var initialScale = 0.25;
var scaleVariation = 0.5;
var alphaDecay = 0.002;
self.heartPool = [];
self.preloadedAssets = {}; // Preload assets for each heart type
for (var type = 0; type <= 9; type++) {
self.preloadedAssets[type] = LK.getAsset('heart_' + type + '_frame_0', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5
});
}
// Initialize heart pool
for (var i = 0; i < nbProjections * 5; i++) {
var heart = new Container();
heart.vx = 0;
heart.vy = 0;
heart.alpha = 0;
heart.update = function () {
this.x += this.vx;
this.y += this.vy;
this.vy += gravity; // Add gravity effect
this.alpha -= alphaDecay;
if (this.alpha <= 0 || this.y > 2900) {
this.alpha = 0;
self.heartPool.push(this);
}
};
// Add all heart type assets to the heart Container
for (var type = 0; type <= 9; type++) {
var heartAsset = heart.attachAsset('heart_' + type + '_frame_0', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5,
heartType: type,
visible: type === 0 // Only make the current heartType visible
});
}
self.heartPool.push(heart);
}
self.x = 2048 / 2;
self.y = 2732 / 2 - 400;
// Function to pop hearts
self.popHearts = function (heartType) {
if (self.isUpdatingHeartType) {
return;
} // Exit if updateHeartType is running
for (var i = 0; i < nbProjections; i++) {
if (self.heartPool.length > 0) {
var heart = self.heartPool.pop();
if (heart.alpha <= 0) {
// Ensure heart has finished its previous animation
heart.x = 0;
heart.y = 0;
heart.vx = (Math.random() - 0.5) * heartSpeed;
heart.vy = (Math.random() - 1.5) * heartSpeed;
heart.alpha = 0.8;
heart.scaleX = initialScale + Math.random() * scaleVariation; // Randomize scale between initialScale and initialScale + scaleVariation
heart.scaleY = heart.scaleX; // Keep aspect ratio consistent
heart.rotation = Math.random() * Math.PI * 2; // Randomize rotation between 0 and 2π
self.addChild(heart);
} else {
self.heartPool.push(heart); // Return heart to pool if it hasn't finished animation
}
}
}
};
self.updateHeartType = function (heartType) {
log("=== updateHeartType ===");
log("Previous heartType:", self.heartType);
log("New heartType:", heartType);
// Make all frames of the current heartType invisible
if (self.heartType !== undefined && self.heartFrames[self.heartType]) {
log("Hiding frames for heartType:", self.heartType);
self.heartFrames[self.heartType].forEach(function (frame, index) {
if (frame) {
frame.visible = false;
log("- Frame", index, "visibility set to false");
}
});
}
// Update heart type
self.heartType = heartType;
log("Heart type updated to:", self.heartType);
// Reset graphics for new heart type
self.resetGraphics();
log("Graphics reset for new heart type");
// Initialize graphics for new heart type
self.currentGraphic = self.heartFrames[self.heartType][5];
self.nextGraphic = self.heartFrames[self.heartType][4];
if (self.currentGraphic) {
self.currentGraphic.visible = true;
self.currentGraphic.scaleX = self.currentGraphic.scaleY = 1.1;
}
if (self.nextGraphic) {
self.nextGraphic.visible = true;
self.nextGraphic.scaleX = self.nextGraphic.scaleY = 1;
}
log("Initialized graphics for new heart type");
// Update projections
if (projectionsManager) {
log("Updating projections manager with heartType:", heartType);
projectionsManager.updateHeartType(heartType);
}
log("=== End updateHeartType ===\n");
};
self.resetGraphics = function () {
log("=== resetGraphics ===");
// Stop current graphic tweens
if (self.currentGraphic && self.currentGraphic._activeTween) {
self.currentGraphic._activeTween.stop();
log("Stopped currentGraphic tween");
}
if (self.nextGraphic && self.nextGraphic._activeTween) {
self.nextGraphic._activeTween.stop();
log("Stopped nextGraphic tween");
}
// Hide only active frames
if (self.currentGraphic) {
self.currentGraphic.visible = false;
log("Set currentGraphic visible to false");
}
if (self.nextGraphic) {
self.nextGraphic.visible = false;
log("Set nextGraphic visible to false");
}
self.currentGraphic = null;
self.nextGraphic = null;
log("Reset currentGraphic and nextGraphic to null");
log("=== End resetGraphics ===\n");
};
});
var RainDrop = Container.expand(function () {
var self = Container.call(this);
self.assets = [];
// Initialize assets for RainDrop
for (var i = 0; i <= maxGenerators; i++) {
var asset = self.attachAsset('generator_' + i, {
anchorX: 0.5,
anchorY: 0.5,
visible: true
});
self.assets.push(asset);
}
// Function to update asset visibility based on index
self.updateAsset = function (index) {
log("Updating asset visibility for index: ", index);
if (index >= 0 && index < self.assets.length) {
self.assets.forEach(function (asset, i) {
asset.visible = i === index;
if (asset.visible) {
log("Asset at index ", i, " is now visible.");
}
});
}
};
});
var RightBoard = Container.expand(function () {
var self = Container.call(this);
// Attach the rightBoard asset to the class
var rightBoardGraphics = self.attachAsset('rightBoard', {
anchorX: 0.5,
anchorY: 0.5,
width: 400,
height: 3000,
alpha: 0
});
self.lastY = 0;
self.velocity = 0;
self.isAnimating = false;
self.lastTime = Date.now();
self.swipeOffset = 0;
// Add momentum animation
self.applyMomentum = function () {
if (Math.abs(self.velocity) < 0.1) {
self.velocity = 0;
self.isAnimating = false;
return;
}
var currentTime = Date.now();
var deltaTime = (currentTime - self.lastTime) / 16; // Normalize to ~60fps
self.lastTime = currentTime;
// Apply friction
self.velocity *= Math.pow(0.95, deltaTime);
// Calculate movement with velocity
var deltaY = self.velocity * deltaTime;
// Check boundaries
var firstButtonNewY = self.y + self.generatorButtons[0].y + deltaY;
var lastButtonNewY = self.y + self.generatorButtons[self.generatorButtons.length - 1].y + deltaY;
// Bounce effect at boundaries
if (firstButtonNewY > 1000) {
self.velocity *= -0.5;
deltaY = 1000 - (self.y + self.generatorButtons[0].y);
} else if (lastButtonNewY < 1366) {
self.velocity *= -0.5;
deltaY = 1366 - (self.y + self.generatorButtons[self.generatorButtons.length - 1].y);
}
// Move all generator buttons
self.generatorButtons.forEach(function (button) {
button.y += deltaY;
});
// Continue animation
if (self.isAnimating) {
LK.setTimeout(self.applyMomentum, 16);
}
};
// Position the rightBoard at the right side of the screen
self.x = 1848;
self.y = 1366;
self.buttonsOffsetX = 50;
self.buttonsOffsetY = -300;
self.generatorButtons = []; // Initialize an array to hold generator buttons
// Create and position generator buttons
for (var i = 0; i <= 9; i++) {
// Todo : use maxGenerators
var generatorButton = new GeneratorButton(i);
generatorButton.x = self.buttonsOffsetX; //0 * self.x + i * 100 - 100; // Position buttons with some spacing
generatorButton.y = self.buttonsOffsetY + i * 300 + i * 300 * 0.1; //self.y;
self.generatorButtons.push(generatorButton);
self.addChild(generatorButton);
}
self.cleanUp = function () {
// Re-calculate positions for all buttons while maintaining the swipe offset
self.generatorButtons.forEach(function (button, index) {
button.y = self.buttonsOffsetY + index * 300 + index * 300 * 0.1 + self.swipeOffset;
});
};
self.down = function (x, y, obj) {
log("RightBoard pressed", y);
globalStartY = y;
self.lastY = y;
self.velocity = 0;
self.isAnimating = false;
dragNode = self;
self.startTime = Date.now();
self.lastTime = Date.now();
};
self.move = function (x, y, obj) {
// Check if any generator button is animating
var isAnyButtonAnimating = self.generatorButtons.some(function (button) {
return button.isAnimating;
});
if (isAnyButtonAnimating) {
return; // Prevent movement if any button is animating
}
if (dragNode === self || dragNode instanceof GeneratorButton) {
// Check if a button or rightBoard is being dragged
var deltaY = y - globalStartY; // Calculate deltaY based on movement
// Only apply movement if the delta exceeds the swipe threshold
if (Math.abs(deltaY) > SWIPE_THRESHOLD) {
log("Move detected with deltaY:", deltaY);
// Calculate new positions for the first and last buttons
var firstButtonNewY = self.y + self.generatorButtons[0].y + deltaY;
var lastButtonNewY = self.y + self.generatorButtons[self.generatorButtons.length - 1].y + deltaY;
log("firstButtonNewY:", firstButtonNewY, "lastButtonNewY:", lastButtonNewY);
// Check if the first button stays above the screen center and the last button stays below the screen center
// Adjust deltaY to prevent moving beyond boundaries
if (deltaY > 0) {
deltaY = Math.min(deltaY, 1000 - (self.y + self.generatorButtons[0].y));
}
// Move all generator buttons vertically based on swipe direction
self.generatorButtons.forEach(function (button) {
button.y += deltaY;
});
self.swipeOffset += deltaY; // Update the total swipe offset
globalStartY = y; // Update globalStartY for continuous movement
}
}
};
self.up = function (x, y, obj) {
var endTime = Date.now();
var timeDiff = endTime - self.startTime;
var distance = Math.sqrt(Math.pow(x - self.startX, 2) + Math.pow(y - globalStartY, 2));
if (timeDiff < TAP_DETECT_DELAY && distance < SWIPE_THRESHOLD) {
// Detected as a tap
log("Detected tap on RightBoard");
} else {
// Start momentum animation
self.isAnimating = true;
LK.setTimeout(function () {
self.applyMomentum();
// Clean up after momentum animation
self.cleanUp();
}, 16);
}
dragNode = null;
};
self.handleSwipe = function (deltaY, y) {
// Calculate new positions for the first and last buttons
var firstButtonNewY = self.y + self.generatorButtons[0].y + deltaY;
var lastButtonNewY = self.y + self.generatorButtons[self.generatorButtons.length - 1].y + deltaY;
log("firstButtonNewY:", firstButtonNewY, "lastButtonNewY:", lastButtonNewY);
// Check if the first button stays above the screen center and the last button stays below the screen center
// Adjust deltaY to prevent moving beyond boundaries
if (deltaY > 0) {
deltaY = Math.min(deltaY, 1000 - (self.y + self.generatorButtons[0].y));
}
if (deltaY < 0) {
deltaY = Math.max(deltaY, 1366 - (self.y + self.generatorButtons[self.generatorButtons.length - 1].y));
}
// Move all generator buttons vertically based on swipe direction
self.generatorButtons.forEach(function (button) {
button.y += deltaY;
});
self.swipeOffset += deltaY; // Update the total swipe offset
globalStartY = y; // Update globalStartY for continuous movement
};
self.move = function (x, y, obj) {
if (dragNode === self || dragNode instanceof GeneratorButton) {
// Check if a button or rightBoard is being dragged
var deltaY = y - globalStartY; // Calculate deltaY based on movement
// Only apply movement if the delta exceeds the swipe threshold
if (Math.abs(deltaY) > SWIPE_THRESHOLD) {
log("Move detected with deltaY:", deltaY);
// Calculate new positions for the first and last buttons
var firstButtonNewY = self.y + self.generatorButtons[0].y + deltaY;
var lastButtonNewY = self.y + self.generatorButtons[self.generatorButtons.length - 1].y + deltaY;
log("firstButtonNewY:", firstButtonNewY, "lastButtonNewY:", lastButtonNewY);
// Adjust deltaY to prevent moving beyond boundaries
if (deltaY > 0) {
deltaY = Math.min(deltaY, 1000 - (self.y + self.generatorButtons[0].y));
}
if (deltaY < 0) {
deltaY = Math.max(deltaY, 1366 - (self.y + self.generatorButtons[self.generatorButtons.length - 1].y));
}
// Move all generator buttons vertically based on swipe direction
self.generatorButtons.forEach(function (button) {
button.y += deltaY;
});
self.swipeOffset += deltaY; // Update the total swipe offset
globalStartY = y; // Update globalStartY for continuous movement
}
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xa16e9f //Init game with black background
});
/****
* Game Code
****/
// Update function to include giftRain update
game.update = function () {
giftRain.update();
};
// Declare a global variable to store the startY position for GeneratorButton events
var globalStartY = 0;
// Declare a global variable to track the node being dragged
var dragNode = null;
var isSwipingButtons = false; // Global flag to track swipe/animation state
// Global event listener for mouse or touch up
game.up = function (x, y, obj) {
dragNode = null; // Reset dragNode when mouse is up
};
// Constants for Generators and Upgrades
var GENERATORS = GENERATORS || {
ROSE: {
id: 0,
name: "Rose",
description: "A charming rose that generates a few love beats",
autoClick: true,
clickRate: 1,
// 1 click per 10 seconds
cost: 10,
upgradeLevel: 0
},
CHOCLATE: {
id: 1,
name: "Choclate",
description: "A sweet choclate that generates love faster",
autoClick: true,
clickRate: 2,
cost: 100,
upgradeLevel: 0
},
CHAIN_BRACELET: {
id: 2,
name: "Chain Bracelet",
description: "A beautiful chain bracelet that generates love even faster",
autoClick: true,
clickRate: 3,
cost: 300,
upgradeLevel: 0
}
};
var UPGRADES = {
LOVE_FILTER: {
id: 0,
name: "Love Filter",
description: "A powerful love filter that make you irresistible",
targetGenerator: 1,
// Targets Generator #1 (Me)
multipliers: [2, 4, 8],
// Levels of multiplier
cost: 12
}
};
function shakeMiddleground() {
tween(middlegroundContainer, {
x: 10,
y: 10
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(middlegroundContainer, {
x: -10,
y: -10
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(middlegroundContainer, {
x: 0,
y: 0
}, {
duration: 100,
easing: tween.easeInOut
});
}
});
}
});
}
function shakeScreen() {
tween(game, {
x: 10,
y: 10
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(game, {
x: -10,
y: -10
}, {
duration: 100,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(game, {
x: 0,
y: 0
}, {
duration: 100,
easing: tween.easeInOut
});
}
});
}
});
}
var isDebug = true;
var SWIPE_THRESHOLD = 10; // Threshold in pixels to distinguish between taps and swipes
var TAP_DETECT_DELAY = 600;
// Declare maxGenerators as a global variable
var maxGenerators = 2;
var MAX_DISPLAY_NUMBER = "9999999999999999"; //9 999 999 999 999 999
// Declare tapCount as a global variable
var tapCount = 0;
var nbHearts = 10;
var backgroundContainer = new Container();
var middlegroundContainer = new Container();
middlegroundContainer.x = 0;
middlegroundContainer.y = 0;
var foregroundContainer = new Container();
game.addChild(backgroundContainer);
game.addChild(middlegroundContainer);
game.addChild(foregroundContainer);
var background = new Background(); // Create a Background instance
backgroundContainer.addChild(background); // Add Background instance to the backgroundContainer
var giftRain = new GiftRain();
middlegroundContainer.addChild(giftRain); // Attach GiftRain to middlegroundContainer for visibility
var projectionsManager = backgroundContainer.addChild(new Projections()); // Place projectionsManager in backgroundContainer
function log() {
if (isDebug) {
console.log.apply(console, arguments);
}
}
// Create a text object to display tapCount
var tapCountText = new Text2('LOVE\r\n ', {
size: 140,
fill: 0xFFFFFF,
dropShadow: true,
align: 'center'
});
// Center the text horizontally, anchor point set at the middle of its top edge.
tapCountText.anchor.set(0.5, 0);
// Position the text at the top-center of the screen.
LK.gui.top.addChild(tapCountText);
// Add a big heart at the center of the screen
var bigHeart = new BigHeart();
middlegroundContainer.addChild(bigHeart);
// Add a RightBoard instance to the foreground container
var rightBoard = new RightBoard();
foregroundContainer.addChild(rightBoard);
function updateTapCountText() {
tapCountText.setText('LOVE\r\n' + tapCount);
}
// Helper function to add large numbers as strings
function addLargeNumbers(a, b) {
// Convert numbers to strings if they aren't already
a = a.toString();
b = b.toString();
var result = '';
var carry = 0;
// Pad the shorter number with zeros
while (a.length < b.length) {
a = '0' + a;
}
while (b.length < a.length) {
b = '0' + b;
}
// Add digits from right to left
for (var i = a.length - 1; i >= 0; i--) {
var sum = parseInt(a[i]) + parseInt(b[i]) + carry;
carry = Math.floor(sum / 10);
result = sum % 10 + result;
}
if (carry) {
result = carry + result;
}
return result;
}
// Helper function to subtract large numbers as strings
function subtractLargeNumbers(a, b) {
// Convert numbers to strings if they aren't already
a = a.toString();
b = b.toString();
// If b is bigger than a, result would be negative
if (b.length > a.length || b.length === a.length && b > a) {
return "0";
}
var result = '';
var borrow = 0;
// Pad b with leading zeros to match a's length
while (b.length < a.length) {
b = '0' + b;
}
// Subtract digits from right to left
for (var i = a.length - 1; i >= 0; i--) {
var digitA = parseInt(a[i]);
var digitB = parseInt(b[i]);
// Handle borrowing
if (borrow) {
digitA--;
borrow = 0;
}
// Need to borrow from next digit
if (digitA < digitB) {
digitA += 10;
borrow = 1;
}
result = digitA - digitB + result;
}
// Remove leading zeros
result = result.replace(/^0+/, '');
return result || "0";
}
// Global ProgressManager
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function _classCallCheck(a, n) {
if (!(a instanceof n)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) {
return t;
}
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) {
return i;
}
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var progressManager;
// Progress Management
function ProgressManager() {
var self = this;
self.maxHeartBeatsPerSecond = 8; // Add maxHeartBeatsPerSecond property
self.priceIncreaseRate = 1.33; // Extracted price increase rate
self.money = tapCount;
self.highestScore = tapCount; // Track highest score reached
self.generators = {};
self.generatorCounts = {}; // Add a counter for each generator
self.upgrades = {};
self.currentTime = Date.now();
self.currentLevel = 0;
self.tapsPerLevel = {
0: 99,
1: 999,
2: 9999,
3: 99999,
4: 999999,
5: 9999999,
6: 99999999,
7: 999999999,
8: 9999999999,
9: 99999999999
};
if (isDebug) {
self.tapsPerLevel = {
0: 10,
1: 50,
2: 100,
3: 200,
4: 300,
5: 400,
6: 500,
7: 600,
8: 700,
9: 1000
};
}
self.lastUpdateTime = self.currentTime;
self.updateGame = function () {
//log("ProgressManager updateGame...");
var now = Date.now();
var deltaTime = now - self.lastUpdateTime;
var tempGenerated = 0;
Object.values(self.generators).forEach(function (generator) {
var generated = generator.generate(deltaTime) * self.generatorCounts[generator.id];
log("generator => +" + generated);
tempGenerated += Math.ceil(generated);
});
var beatsToGenerate = Math.floor(tempGenerated / 2);
beatsToGenerate = Math.min(beatsToGenerate, self.maxHeartBeatsPerSecond);
if (tempGenerated > 0) {
self.money = addLargeNumbers(self.money, tempGenerated.toString());
tapCount = self.money;
// Update highest score if current money is higher
if (parseInt(self.money) > parseInt(self.highestScore)) {
self.highestScore = self.money;
self.updateHeartProgress();
self.checkProgress();
}
}
self.updateGeneratorsUi();
if (tempGenerated > 0) {
for (var i = 0; i < beatsToGenerate; i++) {
LK.setTimeout(function () {
bigHeart.animateBeat();
}, i * 300);
}
}
updateTapCountText();
self.lastUpdateTime = now;
};
self.manualGeneration = function () {
tapCount = addLargeNumbers(tapCount, "1");
self.money = addLargeNumbers(self.money, "1");
// Update highest score if current money is higher
if (parseInt(self.money) > parseInt(self.highestScore)) {
self.highestScore = self.money;
self.updateHeartProgress();
self.checkProgress();
}
log("manualGeneration Tap count: ", tapCount);
updateTapCountText();
self.updateGeneratorsUi();
};
self.updateHeartProgress = function () {
var currentLevelTarget = self.tapsPerLevel[self.currentLevel];
var score = parseInt(self.highestScore);
var progress = Math.min(score / currentLevelTarget, 1);
bigHeart.updateFramesByProgress(progress);
};
self.checkProgress = function () {
// Use highestScore instead of tapCount for level progression
if (self.highestScore >= self.tapsPerLevel[self.currentLevel]) {
if (self.currentLevel < 9) {
// Ensure we don't exceed level 9
var previousLevel = self.currentLevel;
var previousFrames = bigHeart.heartFrames[previousLevel] || [];
previousFrames.forEach(function (frame) {
if (frame && frame._activeTween) {
frame._activeTween.stop();
}
frame.visible = false;
});
bigHeart.animateExplosion(function () {
self.currentLevel++;
self.updateHeartProgress(); // Start new level with correct frame
});
}
}
};
self.buyGenerator = function (generatorId) {
var generatorConfig = Object.values(GENERATORS).find(function (g) {
return g.id === generatorId;
});
if (!generatorConfig) {
log("Generator not found");
return false;
}
// Check if player has enough money
if (parseInt(tapCount) < generatorConfig.cost) {
log("Not enough money");
return false;
}
// Initialize generator if it doesn't exist
if (!self.generators[generatorId]) {
self.generators[generatorId] = new Generator(generatorConfig);
self.generatorCounts[generatorId] = 0;
}
// Subtract cost using subtractLargeNumbers
self.money = subtractLargeNumbers(self.money, generatorConfig.cost.toString());
tapCount = self.money;
// Calculate new cost
var currentCount = self.generatorCounts[generatorId] || 0;
var baseCost = GENERATORS[Object.keys(GENERATORS)[generatorId]].cost;
var newCost = Math.floor(baseCost * Math.pow(self.priceIncreaseRate, currentCount + 1));
log("Updating costs - Base:", baseCost, "Count:", currentCount, "New Cost:", newCost);
// Update costs
generatorConfig.cost = newCost;
rightBoard.generatorButtons[generatorId].config.cost = newCost;
self.generatorCounts[generatorId]++; // Increment the count for the generator
rightBoard.generatorButtons[generatorId].countText.setText(self.generatorCounts[generatorId].toString());
log("Generator", generatorId, "Count:", self.generatorCounts[generatorId], "New Cost:", newCost);
LK.getSound('buyGenerator').play();
giftRain.increaseSpawnRate(generatorId);
return true;
};
self.buyUpgrade = function (upgradeId, generatorId) {
var upgradeConfig = Object.values(UPGRADES).find(function (u) {
return u.id === upgradeId;
});
var targetGenerator = self.generators[generatorId];
if (!upgradeConfig || !targetGenerator) {
throw new Error("Upgrade or Generator not found");
}
if (parseInt(tapCount) < upgradeConfig.cost) {
return false;
}
// Subtract cost using subtractLargeNumbers
self.money = subtractLargeNumbers(self.money, upgradeConfig.cost.toString());
tapCount = self.money;
var upgrade = new Upgrade(upgradeConfig);
upgrade.apply(targetGenerator);
self.upgrades[upgradeId] = upgrade;
return true;
};
self.updateGeneratorsUi = function () {
// Update generator button visibility based on money
//log("Updating Generators UI");
rightBoard.generatorButtons.forEach(function (button, index) {
var generatorConfig = rightBoard.generatorButtons[index].config;
rightBoard.generatorButtons[index].costText.setText(generatorConfig.cost.toString()); // Update the cost text to reflect the new exponential cost
if (generatorConfig) {
// Store a flag 'wasShown' in generatorButton when displayed
if (parseInt(tapCount) >= generatorConfig.cost * 0.75) {
if (!button.wasShown) {
button.x = 2048 + button.width; // Start from the right border
tween(button, {
x: 0
}, {
duration: 500,
easing: tween.easeOut
}); // Animate entrance
}
// Show generator if player has at least 75% of its cost
button.wasShown = true;
button.visible = true;
// Set alpha to 0.75 if player can't buy the generator
button.alpha = parseInt(tapCount) >= generatorConfig.cost ? 1 : 0.6;
} else {
button.visible = button.wasShown;
button.alpha = 0.6;
// If the button has been moved out of its normal position, tween it back to x = 0
if (button.x !== 0) {
tween(button, {
x: 0
}, {
duration: 200,
easing: tween.easeOut
});
}
}
} else {
button.visible = false;
}
});
};
}
function Generator(config) {
var self = this;
self.id = config.id;
self.name = config.name;
self.description = config.description;
self.autoClick = config.autoClick;
self.clickRate = config.clickRate;
self.cost = config.cost;
self.upgradeLevel = config.upgradeLevel;
self.generate = function (deltaTime) {
if (!self.autoClick) {
return 0;
}
var clickAmount = self.clickRate * deltaTime / 1000;
return clickAmount * Math.pow(2, self.upgradeLevel);
};
self.currentMultiplier = Math.pow(2, self.upgradeLevel);
self.manualGenerate = function () {
return 1 * self.currentMultiplier;
};
self.upgrade = function (upgradeMultiplier) {
self.upgradeLevel++;
};
}
function Upgrade(config) {
var self = this;
self.id = config.id;
self.name = config.name;
self.description = config.description;
self.targetGenerator = config.targetGenerator;
self.multipliers = config.multipliers;
self.cost = config.cost;
self.currentLevel = 0;
self.apply = function (generator) {
if (self.currentLevel < self.multipliers.length) {
generator.upgrade(self.multipliers[self.currentLevel]);
self.currentLevel++;
}
};
}
function initializeGame() {
progressManager = new ProgressManager();
var intervalId = LK.setInterval(function () {
progressManager.updateGame();
}, 1000);
// Ensure to clear the interval when necessary
// LK.clearInterval(intervalId);
}
initializeGame();
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