User prompt
add a new function shakeMiddleground that shakes only middlegroundContainer ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (14 edits merged)
Please save this source code
User prompt
use a Background instance for the background
User prompt
create a background class; use background_1 asset
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
augment power of projections in up direction
Code edit (1 edits merged)
Please save this source code
User prompt
in updateHeartType, switch visibility of heart assets in the heartpool objects depending on their heartType
User prompt
ok change Projections algorithm : in Projections constructor add all heat types assets in the heart Container and only make visible current heatType ones
User prompt
ok change Projections algorithm : add all heat types assets in the heart Container and only make visible current heatType ones
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: newHeartAsset is not defined' in or related to this line: 'heart.addChild(newHeartAsset);' Line Number: 240
User prompt
add a flag to avoid using hearts in popHearts while updateHeartType is running
Code edit (1 edits merged)
Please save this source code
User prompt
in updateHeartType remember to update the heartPool using preloadedAssets. don't use `clone` which do not exists and don't use attachAsset neither LK.getasset() inside updateHeartType to avoid performence issues
User prompt
in updateHeartType remember to update the heartPool using preloadedAssets. don't use `clone` which do not exists and don't use attachAsset/getasset to avoid performence issues
User prompt
in updateHeartType remember to update the heartPool using preloadedAssets. don't use `clone` which do not exists and don't use attachAsset to avoid performence issues
User prompt
in updateHeartType remember to update the heartPool using preloadedAssets. don't use `clone` which do not exists and don't use attachAsset to avoid performence issues
User prompt
Please fix the bug: 'TypeError: heartAsset.clone is not a function' in or related to this line: 'heart.addChild(heartAsset.clone());' Line Number: 236
User prompt
in updateHeartType remember to update the heartPool using preloadedAssets
User prompt
in updateHeartType remember to update the heartPool
User prompt
Please fix the bug: 'heartType is not defined' in or related to this line: 'var heartAsset = heart.attachAsset('heart_' + heartType + '_frame_0', {' Line Number: 184
User prompt
review updateHeartType and popHearts because from heartType >= 1 only 1 heart is generatedby popHearts
User prompt
Please fix the bug: 'Error: getChildAt: Supplied index 0 does not exist in the child list, or the supplied DisplayObject must be a child of the caller' in or related to this line: 'heart.removeChildAt(0); // Remove the current heart asset' Line Number: 232
===================================================================
--- original.js
+++ change.js
@@ -5,8 +5,19 @@
/****
* Classes
****/
+var Background = Container.expand(function () {
+ var self = Container.call(this);
+ // Attach the background_1 asset to the class
+ var backgroundGraphics = self.attachAsset('background_1', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Position the background at the center of the screen
+ self.x = 2048 / 2;
+ self.y = 2732 / 2;
+});
// Create a class for bigHeart
var BigHeart = Container.expand(function () {
var self = Container.call(this);
self.currentGraphic = null;
@@ -30,20 +41,21 @@
anchorY: 0.5,
scaleX: 0.9,
scaleY: 0.9,
heartType: type,
- index: 5 - i
+ index: 5 - i,
+ visible: !i
});
}
}
self.currentGraphic = self.heartFrames[self.heartType][5];
self.nextGraphic = self.heartFrames[self.heartType][4];
self.currentGraphic.scaleX = 1.1;
self.currentGraphic.scaleY = 1.1;
+ self.currentGraphic.visible = true;
self.nextGraphic.scaleX = 1.1;
self.nextGraphic.scaleY = 1.1;
- //self.currentGraphic = heartFrames[5];
- //self.nextGraphic = heartFrames[4];
+ 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
@@ -68,8 +80,10 @@
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
}, {
@@ -90,19 +104,8 @@
triggerExplosion(self);
}
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));
- /*
- for (var i = 5; i >= 0; i--) {
- // Calculate the alpha value for each heart frame based on tapCount
- // 1 - (tapCount - (5 - i) * 5) / 10:
- // - (5 - i) * 5: Determines the threshold for each frame based on its index
- // - tapCount - (5 - i) * 5: Calculates how far the tapCount is beyond the threshold
- // - (tapCount - (5 - i) * 5) / 10: Normalizes the value to a range of 0 to 1
- // - 1 - ...: Inverts the value so that higher tapCounts result in lower alpha
- self.heartFrames[self.heartType][i].alpha = Math.max(0, Math.min(1, 1 - (tapCount - (5 - i) * self.nbTapsPerFrame * (self.heartType + 1)) / (10 * (self.heartType + 1))));
- }
- */
// Log the down event
log("Down event triggered on BigHeart");
shakeScreen();
};
@@ -242,9 +245,9 @@
return;
}
frame.visible = false;
});
- projectionsManager.updateHeartType(self.heartType);
+ projectionsManager.updateHeartType(self.heartType + 1);
tween(self.nextGraphic, {
scaleX: 45,
scaleY: 45,
alpha: 0
@@ -259,12 +262,16 @@
// Switch to the next heart type
self.heartType = (self.heartType + 1) % 10;
self.currentGraphic = self.heartFrames[self.heartType][5];
self.nextGraphic = self.heartFrames[self.heartType][4];
+ self.currentGraphic.visible = true;
+ self.nextGraphic.visible = true;
self.explosionTriggered = false; // Reset explosion flag
}
});
// Make next frame bigger
+ self.heartFrames[(self.heartType + 1) % 10][5].visible = true;
+ self.heartFrames[(self.heartType + 1) % 10][4].visible = true;
tween(self.heartFrames[(self.heartType + 1) % 10][5], {
scaleX: 1.1,
scaleY: 1.1
}, {
@@ -302,8 +309,10 @@
});
}
var nbHearts = 10;
var backgroundContainer = new Container();
+var background = new Background();
+backgroundContainer.addChild(background);
var middlegroundContainer = new Container();
var foregroundContainer = new Container();
game.addChild(backgroundContainer);
game.addChild(middlegroundContainer);
@@ -317,11 +326,13 @@
}
// Declare tapCount as a global variable
var tapCount = 0;
// Create a text object to display tapCount
-var tapCountText = new Text2('Love: 0', {
+var tapCountText = new Text2('LOVE\r\n ', {
size: 100,
- fill: 0xFFFFFF
+ 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.
@@ -330,9 +341,9 @@
var bigHeart = new BigHeart();
middlegroundContainer.addChild(bigHeart);
// Update the tapCountText whenever tapCount changes
function updateTapCountText() {
- tapCountText.setText('Love: ' + tapCount);
+ tapCountText.setText('LOVE\r\n' + tapCount);
}
// Global ProgressManager
function _typeof(o) {
"@babel/helpers - typeof";
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