Code edit (7 edits merged)
Please save this source code
User prompt
in GeneratorButton down and up events, don't use a local startY per instance but a unique global one
Code edit (4 edits merged)
Please save this source code
User prompt
now in RightBoard.swipe, don't prevent movement if firstButtonNewY < 1366 / 2 or lastButtonNewY > 1366 but limit detlaY to reach the boundary
User prompt
in RightBoard.swipe, use tween to make buttons movement smooth ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (2 edits merged)
Please save this source code
User prompt
restrict generatorButtons swipe by pre-calculating the new position of first button (0) and last button. Only move all buttons if 1st one stays above screen center and Last one stays under the screen center.
User prompt
restrict generatorButtons swipe like that : - first button (0) should not move under the screen center - last button should not move above the screen center
Code edit (1 edits merged)
Please save this source code
User prompt
now in RightBoard.swipe(); move all the generator Buttons vertically depending on the swipe direction.
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'swipe')' in or related to this line: 'self.swipe = function (deltaX, deltaY) {' Line Number: 1076
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'swipe')' in or related to this line: 'self.swipe = function (deltaX, deltaY) {' Line Number: 1076
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'swipe')' in or related to this line: 'self.swipe = function (deltaX, deltaY) {' Line Number: 1076
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'swipe')' in or related to this line: 'self.swipe = function (deltaX, deltaY) {' Line Number: 1076
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'swipe')' in or related to this line: 'self.swipe = function (deltaX, deltaY) {' Line Number: 1072
User prompt
OK. now on swipe, call a new function swipe() in RightBoard and the delta to it
User prompt
in GeneratorButton down event, differentiate between tap and swipe
Code edit (1 edits merged)
Please save this source code
User prompt
in the same way update : ``` rightBoard.generatorButtons[generatorId].children.forEach(function (child) { if (child instanceof Text2 && child.text !== generatorConfig.cost.toString()) { child.setText(self.generatorCounts[generatorId].toString()); } }); ``` for countText
User prompt
now update the lines : ``` rightBoard.generatorButtons[index].children.forEach(function (child) { if (child instanceof Text2) { child.setText(generatorConfig.cost.toString()); // Update the cost text to reflect the new exponential cost } }); ``` to use costText property
User prompt
Please fix the bug: 'costText is not defined' in or related to this line: 'costText.x = 45;' Line Number: 426
User prompt
Please fix the bug: 'countText is not defined' in or related to this line: 'countText.x = -buttonGraphics.width / 2 + 10;' Line Number: 423
User prompt
in GeneratorButton, make costText & countText public properties (self.costText & self.countText)
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -235,12 +235,12 @@
});
self.addChild(cloneGraphic);
}
LK.setTimeout(function () {
- LK.effects.flashScreen(0xffffff, 1000); // Flash the screen white for 500ms
+ LK.effects.flashScreen(0xffffff, 2000); // Flash the screen white for 500ms
background.changeBackground(progressManager.currentLevel + 1); // Change background when level changes
- if (self.nextGraphic) {
- log("nextGraphic for explosion!", self.nextGraphic);
+ if (cloneGraphic) {
+ log("nextGraphic for explosion!", cloneGraphic);
tween(cloneGraphic, {
scaleX: 45,
scaleY: 45,
alpha: 0
@@ -355,64 +355,79 @@
// self.y = 2732 / 2;
// Event handler called when a press happens on the button
self.down = function (x, y, obj) {
log("Generator button pressed");
- // 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
- tween(self, {
- x: 10,
- y: 10
- }, {
- duration: 100,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- tween(self, {
- x: -10,
- y: -10
- }, {
- duration: 100,
- easing: tween.easeInOut,
- onFinish: function onFinish() {
- tween(self, {
- x: 0,
- y: 0
- }, {
- duration: 100,
- easing: tween.easeInOut
- });
- }
- });
- }
- });
- 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
- });
- }
- });
+ self.startX = x;
+ self.startY = y;
+ self.startTime = Date.now();
+ };
+ 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 - self.startY, 2));
+ if (timeDiff < 200 && distance < 10) {
+ // 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
+ tween(self, {
+ x: 10,
+ y: 10
+ }, {
+ duration: 100,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(self, {
+ x: -10,
+ y: -10
+ }, {
+ duration: 100,
+ easing: tween.easeInOut,
+ onFinish: function onFinish() {
+ tween(self, {
+ x: 0,
+ y: 0
+ }, {
+ duration: 100,
+ easing: tween.easeInOut
+ });
+ }
+ });
+ }
+ });
+ 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 {
- log("Failed to purchase generator");
+ // Detected as a swipe
+ log("Detected swipe on Generator button");
}
};
});
// Create a class for Projections
@@ -514,9 +529,10 @@
self.x = 2048 - rightBoardGraphics.width / 2 - rightBoardGraphics.width * 0.1;
self.y = 2732 / 3;
self.generatorButtons = []; // Initialize an array to hold generator buttons
// Create and position generator buttons
- for (var i = 0; i < 3; i++) {
+ for (var i = 0; i <= 9; i++) {
+ // Todo : use maxGenerators
var generatorButton = new GeneratorButton(i);
generatorButton.x = 0; //0 * self.x + i * 100 - 100; // Position buttons with some spacing
generatorButton.y = i * rightBoardGraphics.height + i * rightBoardGraphics.height * 0.1; //self.y;
self.generatorButtons.push(generatorButton);
@@ -743,9 +759,9 @@
if (isDebug) {
self.tapsPerLevel = {
0: 10,
1: 50,
- 2: 150,
+ 2: 100,
3: 200,
4: 300,
5: 400,
6: 500,
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
beautifull red gift box.
black plastic 3d triangle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
basic red horizontal rectangle button with white text "RESET".