Code edit (8 edits merged)
Please save this source code
User prompt
about the main BigHeart : when score decrease the system with the 6 frames per heart type based on alpha is broken. This requires a deep analysis to find a way that doesn't break current gameplay
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'BigInt is not a function' in or related to this line: 'var tapCount = BigInt(MAX_DISPLAY_NUMBER) - BigInt(1);' Line Number: 1019
User prompt
Please fix the bug: 'BigInt is not a function' in or related to this line: 'var tapCount = BigInt(MAX_DISPLAY_NUMBER) - BigInt(1n);' Line Number: 1019
User prompt
Please fix the bug: 'BigInt is not a function' in or related to this line: 'var tapCount = BigInt(MAX_DISPLAY_NUMBER) - BigInt(1);' Line Number: 1019
User prompt
Please fix the bug: 'BigInt is not a function' in or related to this line: 'var tapCount = BigInt(MAX_DISPLAY_NUMBER) - BigInt(1n);' Line Number: 1019
User prompt
Please fix the bug: 'BigInt is not a function' in or related to this line: 'var tapCount = BigInt(MAX_DISPLAY_NUMBER) - BigInt(1);' Line Number: 1019
User prompt
Please fix the bug: 'Cannot mix BigInt and other types, use explicit conversions' in or related to this line: 'var tapCount = BigInt(MAX_DISPLAY_NUMBER - 1n);' Line Number: 1019
User prompt
Please fix the bug: 'BigInt is not a function' in or related to this line: 'var tapCount = BigInt(MAX_DISPLAY_NUMBER - 1);' Line Number: 1019
User prompt
use BigInt for tapCount and money
Code edit (1 edits merged)
Please save this source code
User prompt
10000000000 => 10 Q : still wrong it shoud be 10000000000 => 10 B Analyze deeply and fix
Code edit (7 edits merged)
Please save this source code
User prompt
when taps is 10000000000 formatTapCount returns 10000000 B" : it's wrong, it should be 10 B
User prompt
currently format function gives : 10000000 => 10000000.000 B it should display non significative zeros
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
when spawning a gift, set a random rotation winthin a range of -PI/4 +PI/4
Code edit (10 edits merged)
Please save this source code
User prompt
in GiftRain, when a gift moves out of bounds move it back to gift.x = Math.random() * (1948 - 100) + 100; gift.y = -300; // Start above the screen in order to make a countious anim
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
I don't see gifts falling; I thing activesGifts are not atteched to the GiftRain instance in the GiftRain class
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -929,11 +929,11 @@
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
+var MAX_DISPLAY_NUMBER = "9999999999999999"; //9 999 999 999 999 999
// Declare tapCount as a global variable
-var tapCount = BigInt(MAX_DISPLAY_NUMBER) - BigInt(1n);
+var tapCount = MAX_DISPLAY_NUMBER;
var nbHearts = 10;
var backgroundContainer = new Container();
var middlegroundContainer = new Container();
middlegroundContainer.x = 0;
@@ -969,23 +969,55 @@
// Add a RightBoard instance to the foreground container
var rightBoard = new RightBoard();
foregroundContainer.addChild(rightBoard);
function formatTapCount(taps) {
- if (taps <= BigInt(MAX_DISPLAY_NUMBER)) {
- return taps.toString();
+ // Convert to string if it's a number
+ taps = taps.toString();
+ // If the number is small enough, return it with commas
+ if (taps.length <= 15) {
+ return parseInt(taps).toLocaleString();
}
var suffixes = ['', 'K', 'M', 'B', 'T', 'Q', 'QT', 'S'];
var tier = 0;
- var tempTaps = taps;
- while (tempTaps >= BigInt(1000) && tier < suffixes.length - 1) {
- tempTaps /= BigInt(1000);
- tier++;
+ // Work with the string length to determine the tier
+ var magnitude = Math.floor((taps.length - 1) / 3);
+ tier = Math.min(magnitude - 3, suffixes.length - 1); // Start suffixes at billions
+ if (tier <= 0) {
+ return parseInt(taps).toLocaleString();
}
- if (tier === 0) {
- return tempTaps.toLocaleString();
+ // Extract the significant digits for formatting
+ var significantDigits = taps.slice(0, 4); // Get first 4 digits
+ var decimalPlaces = 3 - taps.length % 3;
+ // Format the number with up to 3 decimal places
+ var formattedNumber = (parseInt(significantDigits) / Math.pow(10, decimalPlaces)).toFixed(decimalPlaces);
+ // Remove trailing zeros after decimal point
+ formattedNumber = formattedNumber.replace(/\.?0+$/, '');
+ return formattedNumber + ' ' + suffixes[tier];
+}
+// 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;
}
- log(taps + " => " + (Number(tempTaps) / 1000).toFixed(3) + ' ' + suffixes[tier]);
- return (Number(tempTaps) / 1000).toFixed(3) + ' ' + suffixes[tier];
+ 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;
}
// Update the tapCountText whenever tapCount changes
function updateTapCountText() {
tapCountText.setText('LOVE\r\n' + formatTapCount(tapCount));
@@ -1038,9 +1070,9 @@
function ProgressManager() {
var self = this;
self.maxHeartBeatsPerSecond = 8; // Add maxHeartBeatsPerSecond property
self.priceIncreaseRate = 1.33; // Extracted price increase rate
- self.money = BigInt(tapCount); // // TEMP DEBUG !!!// TEMP DEBUG !!!
+ self.money = tapCount; // // TEMP DEBUG !!!// TEMP DEBUG !!!
self.generators = {};
self.generatorCounts = {}; // Add a counter for each generator
self.upgrades = {};
self.currentTime = Date.now();
@@ -1085,9 +1117,9 @@
});
// Calculate beats based on generation rate
var beatsToGenerate = Math.floor(tempGenerated / 2); // One beat every 10 taps generated
beatsToGenerate = Math.min(beatsToGenerate, self.maxHeartBeatsPerSecond); // Cap at 5 beats per update to avoid overwhelming
- self.money = self.money + BigInt(tempGenerated);
+ self.money = addLargeNumbers(self.money, tempGenerated.toString());
self.updateGeneratorsUi();
// Trigger multiple beats based on generation rate
if (tempGenerated > 0) {
for (var i = 0; i < beatsToGenerate; i++) {
@@ -1102,10 +1134,10 @@
self.checkProgress(); // Check the progress
self.lastUpdateTime = now;
};
self.manualGeneration = function () {
- tapCount = tapCount + BigInt(1);
- self.money = self.money + BigInt(1);
+ tapCount = addLargeNumbers(tapCount, "1");
+ self.money = addLargeNumbers(self.money, "1");
log("manualGeneration Tap count: ", tapCount); // Log the tap count
updateTapCountText(); // Update the text display
self.updateGeneratorsUi();
self.checkProgress(); // Check for level up immediately
@@ -1156,18 +1188,18 @@
log("Generator not found");
return false;
}
// Check if player has enough money
- if (self.money < generatorConfig.cost) {
+ 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;
}
- self.money -= generatorConfig.cost;
+ self.money = addLargeNumbers(self.money, (-generatorConfig.cost).toString());
// 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));
@@ -1189,12 +1221,12 @@
var targetGenerator = self.generators[generatorId];
if (!upgradeConfig || !targetGenerator) {
throw new Error("Upgrade or Generator not found");
}
- if (self.money < upgradeConfig.cost) {
+ if (parseInt(tapCount) < upgradeConfig.cost) {
return false;
}
- self.money -= upgradeConfig.cost;
+ self.money = addLargeNumbers(self.money, (-upgradeConfig.cost).toString());
var upgrade = new Upgrade(upgradeConfig);
upgrade.apply(targetGenerator);
self.upgrades[upgradeId] = upgrade;
return true;
@@ -1206,9 +1238,9 @@
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 (self.money >= generatorConfig.cost * 0.75) {
+ if (parseInt(tapCount) >= generatorConfig.cost * 0.75) {
if (!button.wasShown) {
button.x = 2048 + button.width; // Start from the right border
tween(button, {
x: 0
@@ -1220,9 +1252,9 @@
// 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 = self.money >= generatorConfig.cost ? 1 : 0.6;
+ 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
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
reset button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows