User prompt
Now, add an "Upgrades" button and remove all other upgrades from the main screen, placing them in a panel that opens when you click that button. Also, add a Restaurant upgrade, which offers more income but at a very high price.
User prompt
Now, add a button at the bottom that allows us to reset everything so that new players and former players can try out the new features. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Now let's add a money-making restaurant; let the income be high in the mine, but let the price be twice as expensive as all the others.
User prompt
Now add a background photo.
User prompt
Now, factories and farms have a very high income; let's reduce that a bit, meaning the amount they earn us should decrease (for example, if it increases by 5 per level, let's increase it by 3) and increase their prices. Also, let's add mining alongside farms and factories; its income is higher and its price is very high.
User prompt
Arrange the images and text so they don't overlap or extend beyond the screen (only the "factory" and "farm" text and images).
User prompt
Move the images and text slightly to the left.
User prompt
The text and images in the game are mixed up; please fix this. There should be some space between the text and the images.
User prompt
Make Buttons and Texts the same length
User prompt
enlarge text and buttons
Code edit (1 edits merged)
Please save this source code
User prompt
Money Clicker Tycoon
Initial prompt
Make me a money clicker simulator, let's have improvements, let's save our score to the cloud, let's have Money Farm, Money Factory and similar things in our improvements
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
money: 0,
farmCount: 0,
factoryCount: 0,
farmLevel: 1,
factoryLevel: 1,
miningCount: 0,
miningLevel: 1,
highScore: 0
});
/****
* Classes
****/
// Money Button (Tap to earn)
var MoneyBtn = Container.expand(function () {
var self = Container.call(this);
var btn = self.attachAsset('moneyBtn', {
anchorX: 0.5,
anchorY: 0.5
});
// Animate on tap
self.tapAnim = function () {
tween(self, {
scaleX: 1.15,
scaleY: 1.15
}, {
duration: 80,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
scaleX: 1,
scaleY: 1
}, {
duration: 120,
easing: tween.easeIn
});
}
});
};
return self;
});
// Upgrade Button (for farms/factories)
var UpgradeBtn = Container.expand(function () {
var self = Container.call(this);
var btn = self.attachAsset('upgradeBtn', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222222
});
/****
* Game Code
****/
// --- Background ---
var bgImage = LK.getAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
game.addChildAt(bgImage, 0);
// --- Persistent State ---
// Money icon (main tap button)
// Money Farm icon
// Money Factory icon
// Upgrade button
var money = storage.money || 0;
var farmCount = storage.farmCount || 0;
var factoryCount = storage.factoryCount || 0;
var farmLevel = storage.farmLevel || 1;
var factoryLevel = storage.factoryLevel || 1;
var miningCount = storage.miningCount || 0;
var miningLevel = storage.miningLevel || 1;
var highScore = storage.highScore || 0;
// --- Constants ---
var FARM_BASE_COST = 100;
var FACTORY_BASE_COST = 1200;
var MINING_BASE_COST = 5000;
var FARM_BASE_INCOME = 1;
var FACTORY_BASE_INCOME = 12;
var MINING_BASE_INCOME = 50;
var FARM_UPGRADE_COST = 100;
var FACTORY_UPGRADE_COST = 1000;
var MINING_UPGRADE_COST = 5000;
var FARM_UPGRADE_MULT = 1.5;
var FACTORY_UPGRADE_MULT = 1.5;
var MINING_UPGRADE_MULT = 1.5;
// --- UI Elements ---
var moneyBtn = new MoneyBtn();
moneyBtn.x = 2048 / 2;
moneyBtn.y = 1100;
game.addChild(moneyBtn);
var moneyTxt = new Text2('', {
size: 180,
fill: "#fff"
});
moneyTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(moneyTxt);
var highScoreTxt = new Text2('', {
size: 80,
fill: 0xFFD700
});
highScoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(highScoreTxt);
highScoreTxt.y = 180;
// --- Farm Section ---
var farmIcon = LK.getAsset('farmIcon', {
anchorX: 0.5,
anchorY: 0.5
});
farmIcon.x = 350;
farmIcon.y = 1800;
game.addChild(farmIcon);
var farmCountTxt = new Text2('', {
size: 100,
fill: "#fff"
});
farmCountTxt.anchor.set(0.5, 0.5);
farmCountTxt.x = farmIcon.x;
farmCountTxt.y = farmIcon.y + 220;
game.addChild(farmCountTxt);
var farmBuyBtn = new UpgradeBtn();
farmBuyBtn.x = 350;
farmBuyBtn.y = farmIcon.y + 380;
game.addChild(farmBuyBtn);
var farmBuyTxt = new Text2('', {
size: 60,
fill: "#fff"
});
farmBuyTxt.anchor.set(0.5, 0.5);
farmBuyTxt.x = farmBuyBtn.x;
farmBuyTxt.y = farmBuyBtn.y;
game.addChild(farmBuyTxt);
var farmUpgradeBtn = new UpgradeBtn();
farmUpgradeBtn.x = 350;
farmUpgradeBtn.y = farmBuyBtn.y + 180;
game.addChild(farmUpgradeBtn);
var farmUpgradeTxt = new Text2('', {
size: 60,
fill: "#fff"
});
farmUpgradeTxt.anchor.set(0.5, 0.5);
farmUpgradeTxt.x = farmUpgradeBtn.x;
farmUpgradeTxt.y = farmUpgradeBtn.y;
game.addChild(farmUpgradeTxt);
// --- Factory Section ---
var factoryIcon = LK.getAsset('factoryIcon', {
anchorX: 0.5,
anchorY: 0.5
});
factoryIcon.x = 1698;
factoryIcon.y = 1800;
game.addChild(factoryIcon);
var factoryCountTxt = new Text2('', {
size: 100,
fill: "#fff"
});
factoryCountTxt.anchor.set(0.5, 0.5);
factoryCountTxt.x = factoryIcon.x;
factoryCountTxt.y = factoryIcon.y + 220;
game.addChild(factoryCountTxt);
var factoryBuyBtn = new UpgradeBtn();
factoryBuyBtn.x = 1698;
factoryBuyBtn.y = factoryIcon.y + 380;
game.addChild(factoryBuyBtn);
var factoryBuyTxt = new Text2('', {
size: 60,
fill: "#fff"
});
factoryBuyTxt.anchor.set(0.5, 0.5);
factoryBuyTxt.x = factoryBuyBtn.x;
factoryBuyTxt.y = factoryBuyBtn.y;
game.addChild(factoryBuyTxt);
var factoryUpgradeBtn = new UpgradeBtn();
factoryUpgradeBtn.x = 1698;
factoryUpgradeBtn.y = factoryBuyBtn.y + 180;
game.addChild(factoryUpgradeBtn);
var factoryUpgradeTxt = new Text2('', {
size: 60,
fill: "#fff"
});
factoryUpgradeTxt.anchor.set(0.5, 0.5);
factoryUpgradeTxt.x = factoryUpgradeBtn.x;
factoryUpgradeTxt.y = factoryUpgradeBtn.y;
game.addChild(factoryUpgradeTxt);
// --- Mining Section ---
var miningIcon = LK.getAsset('miningIcon', {
anchorX: 0.5,
anchorY: 0.5
});
miningIcon.x = 1024;
miningIcon.y = 1800;
game.addChild(miningIcon);
var miningCountTxt = new Text2('', {
size: 100,
fill: "#fff"
});
miningCountTxt.anchor.set(0.5, 0.5);
miningCountTxt.x = miningIcon.x;
miningCountTxt.y = miningIcon.y + 220;
game.addChild(miningCountTxt);
var miningBuyBtn = new UpgradeBtn();
miningBuyBtn.x = 1024;
miningBuyBtn.y = miningIcon.y + 380;
game.addChild(miningBuyBtn);
var miningBuyTxt = new Text2('', {
size: 60,
fill: "#fff"
});
miningBuyTxt.anchor.set(0.5, 0.5);
miningBuyTxt.x = miningBuyBtn.x;
miningBuyTxt.y = miningBuyBtn.y;
game.addChild(miningBuyTxt);
var miningUpgradeBtn = new UpgradeBtn();
miningUpgradeBtn.x = 1024;
miningUpgradeBtn.y = miningBuyBtn.y + 180;
game.addChild(miningUpgradeBtn);
var miningUpgradeTxt = new Text2('', {
size: 60,
fill: "#fff"
});
miningUpgradeTxt.anchor.set(0.5, 0.5);
miningUpgradeTxt.x = miningUpgradeBtn.x;
miningUpgradeTxt.y = miningUpgradeBtn.y;
game.addChild(miningUpgradeTxt);
// --- Helper Functions ---
function formatMoney(val) {
if (val >= 1e9) return (val / 1e9).toFixed(2) + "B";
if (val >= 1e6) return (val / 1e6).toFixed(2) + "M";
if (val >= 1e3) return (val / 1e3).toFixed(2) + "K";
return Math.floor(val) + "";
}
function getFarmCost() {
return Math.floor(FARM_BASE_COST * Math.pow(1.15, farmCount));
}
function getFactoryCost() {
return Math.floor(FACTORY_BASE_COST * Math.pow(1.18, factoryCount));
}
function getFarmIncome() {
return farmCount * FARM_BASE_INCOME * farmLevel;
}
function getFactoryIncome() {
return factoryCount * FACTORY_BASE_INCOME * factoryLevel;
}
function getMiningCost() {
return Math.floor(MINING_BASE_COST * Math.pow(1.25, miningCount));
}
function getMiningIncome() {
return miningCount * MINING_BASE_INCOME * miningLevel;
}
function getMiningUpgradeCost() {
return Math.floor(MINING_UPGRADE_COST * Math.pow(MINING_UPGRADE_MULT, miningLevel - 1));
}
function getFarmUpgradeCost() {
return Math.floor(FARM_UPGRADE_COST * Math.pow(FARM_UPGRADE_MULT, farmLevel - 1));
}
function getFactoryUpgradeCost() {
return Math.floor(FACTORY_UPGRADE_COST * Math.pow(FACTORY_UPGRADE_MULT, factoryLevel - 1));
}
function saveState() {
storage.money = money;
storage.farmCount = farmCount;
storage.factoryCount = factoryCount;
storage.farmLevel = farmLevel;
storage.factoryLevel = factoryLevel;
storage.miningCount = miningCount;
storage.miningLevel = miningLevel;
if (money > highScore) {
highScore = money;
storage.highScore = highScore;
}
}
// --- UI Update ---
function updateUI() {
moneyTxt.setText("Money: $" + formatMoney(money));
highScoreTxt.setText("High Score: $" + formatMoney(highScore));
farmCountTxt.setText("Farms: " + farmCount + "\nIncome: $" + formatMoney(getFarmIncome()) + "/s");
farmBuyTxt.setText("Buy Farm\n$" + formatMoney(getFarmCost()));
farmUpgradeTxt.setText("Upgrade Farm\nLvl " + farmLevel + " ($" + formatMoney(getFarmUpgradeCost()) + ")");
factoryCountTxt.setText("Factories: " + factoryCount + "\nIncome: $" + formatMoney(getFactoryIncome()) + "/s");
factoryBuyTxt.setText("Buy Factory\n$" + formatMoney(getFactoryCost()));
factoryUpgradeTxt.setText("Upgrade Factory\nLvl " + factoryLevel + " ($" + formatMoney(getFactoryUpgradeCost()) + ")");
miningCountTxt.setText("Mines: " + miningCount + "\nIncome: $" + formatMoney(getMiningIncome()) + "/s");
miningBuyTxt.setText("Buy Mine\n$" + formatMoney(getMiningCost()));
miningUpgradeTxt.setText("Upgrade Mine\nLvl " + miningLevel + " ($" + formatMoney(getMiningUpgradeCost()) + ")");
}
// --- Money Button Tap ---
moneyBtn.down = function (x, y, obj) {
var add = 1 + farmLevel + factoryLevel;
money += add;
if (money > highScore) {
highScore = money;
storage.highScore = highScore;
}
moneyBtn.tapAnim();
updateUI();
saveState();
};
// --- Farm Buy ---
farmBuyBtn.down = function (x, y, obj) {
var cost = getFarmCost();
if (money >= cost) {
money -= cost;
farmCount += 1;
updateUI();
saveState();
// Animate farm icon
tween(farmIcon, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
onFinish: function onFinish() {
tween(farmIcon, {
scaleX: 1,
scaleY: 1
}, {
duration: 120
});
}
});
}
};
// --- Farm Upgrade ---
farmUpgradeBtn.down = function (x, y, obj) {
var cost = getFarmUpgradeCost();
if (money >= cost) {
money -= cost;
farmLevel += 1;
updateUI();
saveState();
// Animate farm icon
tween(farmIcon, {
tint: 0xA5D6A7
}, {
duration: 200,
onFinish: function onFinish() {
tween(farmIcon, {
tint: 0x4CAF50
}, {
duration: 200
});
}
});
}
};
// --- Factory Buy ---
factoryBuyBtn.down = function (x, y, obj) {
var cost = getFactoryCost();
if (money >= cost) {
money -= cost;
factoryCount += 1;
updateUI();
saveState();
// Animate factory icon
tween(factoryIcon, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
onFinish: function onFinish() {
tween(factoryIcon, {
scaleX: 1,
scaleY: 1
}, {
duration: 120
});
}
});
}
};
// --- Factory Upgrade ---
factoryUpgradeBtn.down = function (x, y, obj) {
var cost = getFactoryUpgradeCost();
if (money >= cost) {
money -= cost;
factoryLevel += 1;
updateUI();
saveState();
// Animate factory icon
tween(factoryIcon, {
tint: 0x90CAF9
}, {
duration: 200,
onFinish: function onFinish() {
tween(factoryIcon, {
tint: 0x2196F3
}, {
duration: 200
});
}
});
}
};
// --- Mining Buy ---
miningBuyBtn.down = function (x, y, obj) {
var cost = getMiningCost();
if (money >= cost) {
money -= cost;
miningCount += 1;
updateUI();
saveState();
// Animate mining icon
tween(miningIcon, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
onFinish: function onFinish() {
tween(miningIcon, {
scaleX: 1,
scaleY: 1
}, {
duration: 120
});
}
});
}
};
// --- Mining Upgrade ---
miningUpgradeBtn.down = function (x, y, obj) {
var cost = getMiningUpgradeCost();
if (money >= cost) {
money -= cost;
miningLevel += 1;
updateUI();
saveState();
// Animate mining icon
tween(miningIcon, {
tint: 0xFFD700
}, {
duration: 200,
onFinish: function onFinish() {
tween(miningIcon, {
tint: 0xFFA500
}, {
duration: 200
});
}
});
}
};
// --- Passive Income Timer ---
var incomeTimer = LK.setInterval(function () {
var farmIncome = getFarmIncome() / 10; // 10x per second
var factoryIncome = getFactoryIncome() / 10;
var miningIncome = getMiningIncome() / 10;
var total = farmIncome + factoryIncome + miningIncome;
if (total > 0) {
money += total;
if (money > highScore) {
highScore = money;
storage.highScore = highScore;
}
updateUI();
saveState();
}
}, 100);
// --- Save every 5 seconds for redundancy ---
var saveTimer = LK.setInterval(function () {
saveState();
}, 5000);
// --- Reset Button ---
var resetBtn = new UpgradeBtn();
resetBtn.x = 2048 / 2;
resetBtn.y = 2600;
game.addChild(resetBtn);
var resetBtnTxt = new Text2('Reset Game', {
size: 60,
fill: "#fff"
});
resetBtnTxt.anchor.set(0.5, 0.5);
resetBtnTxt.x = resetBtn.x;
resetBtnTxt.y = resetBtn.y;
game.addChild(resetBtnTxt);
resetBtn.down = function (x, y, obj) {
money = 0;
farmCount = 0;
factoryCount = 0;
farmLevel = 1;
factoryLevel = 1;
miningCount = 0;
miningLevel = 1;
highScore = 0;
storage.money = 0;
storage.farmCount = 0;
storage.factoryCount = 0;
storage.farmLevel = 1;
storage.factoryLevel = 1;
storage.miningCount = 0;
storage.miningLevel = 1;
storage.highScore = 0;
updateUI();
saveState();
// Animate reset button
tween(resetBtn, {
scaleX: 0.9,
scaleY: 0.9
}, {
duration: 100,
onFinish: function onFinish() {
tween(resetBtn, {
scaleX: 1,
scaleY: 1
}, {
duration: 120
});
}
});
};
// --- Initial UI Update ---
updateUI(); ===================================================================
--- original.js
+++ change.js
@@ -9,10 +9,8 @@
farmLevel: 1,
factoryLevel: 1,
miningCount: 0,
miningLevel: 1,
- restaurantCount: 0,
- restaurantLevel: 1,
highScore: 0
});
/****
@@ -85,28 +83,22 @@
var farmLevel = storage.farmLevel || 1;
var factoryLevel = storage.factoryLevel || 1;
var miningCount = storage.miningCount || 0;
var miningLevel = storage.miningLevel || 1;
-var restaurantCount = storage.restaurantCount || 0;
-var restaurantLevel = storage.restaurantLevel || 1;
var highScore = storage.highScore || 0;
// --- Constants ---
var FARM_BASE_COST = 100;
var FACTORY_BASE_COST = 1200;
var MINING_BASE_COST = 5000;
-var RESTAURANT_BASE_COST = 20000;
var FARM_BASE_INCOME = 1;
var FACTORY_BASE_INCOME = 12;
var MINING_BASE_INCOME = 50;
-var RESTAURANT_BASE_INCOME = 150;
var FARM_UPGRADE_COST = 100;
var FACTORY_UPGRADE_COST = 1000;
var MINING_UPGRADE_COST = 5000;
-var RESTAURANT_UPGRADE_COST = 20000;
var FARM_UPGRADE_MULT = 1.5;
var FACTORY_UPGRADE_MULT = 1.5;
var MINING_UPGRADE_MULT = 1.5;
-var RESTAURANT_UPGRADE_MULT = 1.5;
// --- UI Elements ---
var moneyBtn = new MoneyBtn();
moneyBtn.x = 2048 / 2;
moneyBtn.y = 1100;
@@ -243,48 +235,8 @@
miningUpgradeTxt.anchor.set(0.5, 0.5);
miningUpgradeTxt.x = miningUpgradeBtn.x;
miningUpgradeTxt.y = miningUpgradeBtn.y;
game.addChild(miningUpgradeTxt);
-// --- Restaurant Section ---
-var restaurantIcon = LK.getAsset('restaurantIcon', {
- anchorX: 0.5,
- anchorY: 0.5
-});
-restaurantIcon.x = 1024;
-restaurantIcon.y = 2300;
-game.addChild(restaurantIcon);
-var restaurantCountTxt = new Text2('', {
- size: 100,
- fill: "#fff"
-});
-restaurantCountTxt.anchor.set(0.5, 0.5);
-restaurantCountTxt.x = restaurantIcon.x;
-restaurantCountTxt.y = restaurantIcon.y + 220;
-game.addChild(restaurantCountTxt);
-var restaurantBuyBtn = new UpgradeBtn();
-restaurantBuyBtn.x = 1024;
-restaurantBuyBtn.y = restaurantIcon.y + 380;
-game.addChild(restaurantBuyBtn);
-var restaurantBuyTxt = new Text2('', {
- size: 60,
- fill: "#fff"
-});
-restaurantBuyTxt.anchor.set(0.5, 0.5);
-restaurantBuyTxt.x = restaurantBuyBtn.x;
-restaurantBuyTxt.y = restaurantBuyBtn.y;
-game.addChild(restaurantBuyTxt);
-var restaurantUpgradeBtn = new UpgradeBtn();
-restaurantUpgradeBtn.x = 1024;
-restaurantUpgradeBtn.y = restaurantBuyBtn.y + 180;
-game.addChild(restaurantUpgradeBtn);
-var restaurantUpgradeTxt = new Text2('', {
- size: 60,
- fill: "#fff"
-});
-restaurantUpgradeTxt.anchor.set(0.5, 0.5);
-restaurantUpgradeTxt.x = restaurantUpgradeBtn.x;
-restaurantUpgradeTxt.y = restaurantUpgradeBtn.y;
-game.addChild(restaurantUpgradeTxt);
// --- Helper Functions ---
function formatMoney(val) {
if (val >= 1e9) return (val / 1e9).toFixed(2) + "B";
if (val >= 1e6) return (val / 1e6).toFixed(2) + "M";
@@ -311,17 +263,8 @@
}
function getMiningUpgradeCost() {
return Math.floor(MINING_UPGRADE_COST * Math.pow(MINING_UPGRADE_MULT, miningLevel - 1));
}
-function getRestaurantCost() {
- return Math.floor(RESTAURANT_BASE_COST * Math.pow(1.3, restaurantCount));
-} //{1l_a}
-function getRestaurantIncome() {
- return restaurantCount * RESTAURANT_BASE_INCOME * restaurantLevel;
-} //{1l_b}
-function getRestaurantUpgradeCost() {
- return Math.floor(RESTAURANT_UPGRADE_COST * Math.pow(RESTAURANT_UPGRADE_MULT, restaurantLevel - 1));
-} //{1l_c}
function getFarmUpgradeCost() {
return Math.floor(FARM_UPGRADE_COST * Math.pow(FARM_UPGRADE_MULT, farmLevel - 1));
}
function getFactoryUpgradeCost() {
@@ -334,10 +277,8 @@
storage.farmLevel = farmLevel;
storage.factoryLevel = factoryLevel;
storage.miningCount = miningCount;
storage.miningLevel = miningLevel;
- storage.restaurantCount = restaurantCount;
- storage.restaurantLevel = restaurantLevel;
if (money > highScore) {
highScore = money;
storage.highScore = highScore;
}
@@ -354,11 +295,8 @@
factoryUpgradeTxt.setText("Upgrade Factory\nLvl " + factoryLevel + " ($" + formatMoney(getFactoryUpgradeCost()) + ")");
miningCountTxt.setText("Mines: " + miningCount + "\nIncome: $" + formatMoney(getMiningIncome()) + "/s");
miningBuyTxt.setText("Buy Mine\n$" + formatMoney(getMiningCost()));
miningUpgradeTxt.setText("Upgrade Mine\nLvl " + miningLevel + " ($" + formatMoney(getMiningUpgradeCost()) + ")");
- restaurantCountTxt.setText("Restaurants: " + restaurantCount + "\nIncome: $" + formatMoney(getRestaurantIncome()) + "/s");
- restaurantBuyTxt.setText("Buy Restaurant\n$" + formatMoney(getRestaurantCost()));
- restaurantUpgradeTxt.setText("Upgrade Restaurant\nLvl " + restaurantLevel + " ($" + formatMoney(getRestaurantUpgradeCost()) + ")");
}
// --- Money Button Tap ---
moneyBtn.down = function (x, y, obj) {
var add = 1 + farmLevel + factoryLevel;
@@ -491,33 +429,8 @@
}
});
}
};
-// --- Restaurant Buy ---
-restaurantBuyBtn.down = function (x, y, obj) {
- var cost = getRestaurantCost();
- if (money >= cost) {
- money -= cost;
- restaurantCount += 1;
- updateUI();
- saveState();
- // Animate restaurant icon
- tween(restaurantIcon, {
- scaleX: 1.2,
- scaleY: 1.2
- }, {
- duration: 100,
- onFinish: function onFinish() {
- tween(restaurantIcon, {
- scaleX: 1,
- scaleY: 1
- }, {
- duration: 120
- });
- }
- });
- }
-};
// --- Mining Upgrade ---
miningUpgradeBtn.down = function (x, y, obj) {
var cost = getMiningUpgradeCost();
if (money >= cost) {
@@ -539,38 +452,14 @@
}
});
}
};
-// --- Restaurant Upgrade ---
-restaurantUpgradeBtn.down = function (x, y, obj) {
- var cost = getRestaurantUpgradeCost();
- if (money >= cost) {
- money -= cost;
- restaurantLevel += 1;
- updateUI();
- saveState();
- // Animate restaurant icon
- tween(restaurantIcon, {
- tint: 0xFF69B4
- }, {
- duration: 200,
- onFinish: function onFinish() {
- tween(restaurantIcon, {
- tint: 0xFF1493
- }, {
- duration: 200
- });
- }
- });
- }
-};
// --- Passive Income Timer ---
var incomeTimer = LK.setInterval(function () {
var farmIncome = getFarmIncome() / 10; // 10x per second
var factoryIncome = getFactoryIncome() / 10;
var miningIncome = getMiningIncome() / 10;
- var restaurantIncome = getRestaurantIncome() / 10;
- var total = farmIncome + factoryIncome + miningIncome + restaurantIncome;
+ var total = farmIncome + factoryIncome + miningIncome;
if (total > 0) {
money += total;
if (money > highScore) {
highScore = money;
@@ -583,6 +472,54 @@
// --- Save every 5 seconds for redundancy ---
var saveTimer = LK.setInterval(function () {
saveState();
}, 5000);
+// --- Reset Button ---
+var resetBtn = new UpgradeBtn();
+resetBtn.x = 2048 / 2;
+resetBtn.y = 2600;
+game.addChild(resetBtn);
+var resetBtnTxt = new Text2('Reset Game', {
+ size: 60,
+ fill: "#fff"
+});
+resetBtnTxt.anchor.set(0.5, 0.5);
+resetBtnTxt.x = resetBtn.x;
+resetBtnTxt.y = resetBtn.y;
+game.addChild(resetBtnTxt);
+resetBtn.down = function (x, y, obj) {
+ money = 0;
+ farmCount = 0;
+ factoryCount = 0;
+ farmLevel = 1;
+ factoryLevel = 1;
+ miningCount = 0;
+ miningLevel = 1;
+ highScore = 0;
+ storage.money = 0;
+ storage.farmCount = 0;
+ storage.factoryCount = 0;
+ storage.farmLevel = 1;
+ storage.factoryLevel = 1;
+ storage.miningCount = 0;
+ storage.miningLevel = 1;
+ storage.highScore = 0;
+ updateUI();
+ saveState();
+ // Animate reset button
+ tween(resetBtn, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(resetBtn, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 120
+ });
+ }
+ });
+};
// --- Initial UI Update ---
updateUI();
\ No newline at end of file
Coin icon . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
field with money tree. In-Game asset. 2d. High contrast. No shadows
money factory. In-Game asset. 2d. High contrast. No shadows
A diamond pickaxe resting on a mining icon, with raining dollar signs in the background. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat