/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { money: 0, totalMoney: 0, currentTier: 0, tapValue: 1, passiveIncome: 0, employees: 0, employeeCost: 10, upgradeCost: 100, tierUpgradeCost: 1000 }); /**** * Classes ****/ var Business = Container.expand(function (tier, name, color) { var self = Container.call(this); self.tier = tier; self.name = name; var assetId = ['lemonadeStand', 'bakery', 'restaurant', 'groceryStore', 'shoppingMall', 'corporation', 'globalConglomerate'][tier]; var businessGraphic = self.attachAsset(assetId, { anchorX: 0.5, anchorY: 0.5 }); if (assetId === 'groceryStore') { businessGraphic.scaleX = 2; businessGraphic.scaleY = 2; } var nameText = new Text2(name, { size: 50, fill: 0xFFFFFF, font: "Comic Sans MS" }); nameText.anchor.set(0.5, 0); nameText.y = businessGraphic.height / 2 + 20; self.addChild(nameText); self.down = function (x, y, obj) { self.tapBusiness(); LK.getSound('tap').play(); // Create coin particle effect self.createCoinParticle(); }; self.tapBusiness = function () { var moneyEarned = storage.tapValue; storage.money += moneyEarned; storage.totalMoney += moneyEarned; // Show floating text effect self.showFloatingText("+" + moneyEarned); }; self.showFloatingText = function (text) { var floatingText = new Text2(text, { size: 50, fill: 0xFFFF00, font: "Comic Sans MS" }); floatingText.anchor.set(0.5, 0.5); floatingText.x = 0; floatingText.y = -50; self.addChild(floatingText); // Animate the text floating up and fading tween(floatingText, { y: -150, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { floatingText.destroy(); } }); }; self.createCoinParticle = function () { var particle = LK.getAsset('coinParticle', { anchorX: 0.5, anchorY: 0.5, x: 0, y: 0 }); self.addChild(particle); var angle = Math.random() * Math.PI * 2; var distance = 100 + Math.random() * 100; var targetX = Math.cos(angle) * distance; var targetY = Math.sin(angle) * distance; tween(particle, { x: targetX, y: targetY, alpha: 0, scaleX: 0.5, scaleY: 0.5 }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { particle.destroy(); } }); }; // Visual bounce effect when tapped self.bounce = function () { tween.stop(businessGraphic, { scaleX: true, scaleY: true }); businessGraphic.scaleX = businessGraphic.scaleY = 0.9; tween(businessGraphic, { scaleX: 1, scaleY: 1 }, { duration: 300, easing: tween.elasticOut }); }; return self; }); var Button = Container.expand(function (width, height, color, text, textSize, textColor) { var self = Container.call(this); var buttonShape = LK.getAsset('bullet', { anchorX: 0.5, anchorY: 0.5, width: width, height: height, tint: color || 0x4477FF }); self.addChild(buttonShape); var buttonText = new Text2(text || "", { size: textSize || 40, fill: textColor || "#FFFFFF" }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.setText = function (newText) { buttonText.setText(newText); }; self.setEnabled = function (enabled) { self.enabled = enabled; buttonShape.alpha = enabled ? 1.0 : 0.5; }; self.down = function (x, y, obj) { if (self.enabled !== false) { tween.stop(buttonShape, { scaleX: true, scaleY: true }); buttonShape.scaleX = buttonShape.scaleY = 0.9; if (self.onPress) { self.onPress(); } } }; self.up = function (x, y, obj) { tween(buttonShape, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); }; self.enabled = true; return self; }); var CoinParticle = Container.expand(function () { var self = Container.call(this); var coinGraphic = self.attachAsset('coinParticle', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Employee = Container.expand(function () { var self = Container.call(this); var employeeGraphic = self.attachAsset('employee', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5 }); self.update = function () { self.rotation += 0.01; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x333333 }); /**** * Game Code ****/ // Game constants var TIERS = [{ name: "Lemonade Stand", multiplier: 1 }, { name: "Bakery", multiplier: 3 }, { name: "Restaurant", multiplier: 7 }, { name: "Grocery Store", multiplier: 15 }, { name: "Shopping Mall", multiplier: 40 }, { name: "Corporation", multiplier: 100 }, { name: "Global Conglomerate", multiplier: 300 }]; // Main game variables var currentBusiness; var moneyText; var passiveIncomeText; var tapValueText; var employeeCountText; var employeeButton; var upgradeButton; var tierUpgradeButton; var employees = []; var lastUpdateTime = Date.now(); // Initialize the UI function initUI() { // Initialize the UI LK.playMusic('bgMusic'); // Play background music when the game starts var background = LK.getAsset('background', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); game.addChild(background); storage.money = 0; // Reset money to 0 storage.employees = 0; // Reset employees to 0 storage.tapValue = 1; // Reset tap value to 1 storage.passiveIncome = 0; // Set passive income to 0 storage.currentTier = 0; // Reset to initial tier storage.employeeCost = 10; // Reset employee cost to original storage.upgradeCost = 100; // Reset upgrade cost to original storage.tierUpgradeCost = 1000; // Reset tier upgrade cost to original currentBusiness = new Business(storage.currentTier, TIERS[storage.currentTier].name); currentBusiness.x = 2048 / 2; currentBusiness.y = 2732 / 2 - 200; game.addChild(currentBusiness); // Money text display moneyText = new Text2("$" + formatNumber(storage.money), { size: 80, fill: 0xFFFFFF, font: "Comic Sans MS" }); moneyText.anchor.set(0.5, 0); LK.gui.top.addChild(moneyText); moneyText.y = 50; // Passive income display passiveIncomeText = new Text2("$" + formatNumber(storage.passiveIncome) + "/sec", { size: 40, fill: 0xAAFFAA, font: "Comic Sans MS" }); passiveIncomeText.anchor.set(0.5, 0); LK.gui.top.addChild(passiveIncomeText); passiveIncomeText.y = 140; // Tap value display tapValueText = new Text2("Tap value: $" + formatNumber(storage.tapValue), { size: 40, fill: 0xAAAAFF, font: "Comic Sans MS" }); tapValueText.anchor.set(0.5, 0); LK.gui.top.addChild(tapValueText); tapValueText.y = 190; // Employee count display employeeCountText = new Text2("Employees: " + storage.employees, { size: 40, fill: 0xFFAAAA, font: "Comic Sans MS" }); employeeCountText.anchor.set(0.5, 0); LK.gui.top.addChild(employeeCountText); employeeCountText.y = 240; // Hire employee button employeeButton = new Button(480, 120, 0x4477FF, "Hire Employee: $" + formatNumber(storage.employeeCost), 35); upgradeButton = new Button(480, 120, 0x44AA44, "Upgrade Tap: $" + formatNumber(storage.upgradeCost), 35); tierUpgradeButton = new Button(480, 120, 0xAA4444, "Upgrade Business: $" + formatNumber(storage.tierUpgradeCost), 35); employeeButton.x = 2048 / 2 - 450; employeeButton.y = 2732 - 400; game.addChild(employeeButton); employeeButton.onPress = function () { if (storage.money >= storage.employeeCost) { storage.money -= storage.employeeCost; storage.employees += 1; storage.passiveIncome += calculateEmployeeValue(); storage.employeeCost = Math.floor(storage.employeeCost * 1.3); addEmployee(); updateUI(); LK.getSound('upgrade').play(); } }; // Upgrade tap value button upgradeButton.x = 2048 / 2; upgradeButton.y = 2732 - 400; game.addChild(upgradeButton); upgradeButton.onPress = function () { if (storage.money >= storage.upgradeCost) { storage.money -= storage.upgradeCost; storage.tapValue = Math.floor(storage.tapValue * 2); storage.upgradeCost = Math.floor(storage.upgradeCost * 2); updateUI(); currentBusiness.bounce(); LK.getSound('upgrade').play(); } }; // Upgrade business tier button tierUpgradeButton.x = 2048 / 2 + 450; tierUpgradeButton.y = 2732 - 400; game.addChild(tierUpgradeButton); tierUpgradeButton.onPress = function () { if (storage.money >= storage.tierUpgradeCost && storage.currentTier < TIERS.length - 1) { storage.money -= storage.tierUpgradeCost; storage.currentTier += 1; storage.tierUpgradeCost = Math.floor(storage.tierUpgradeCost * 5); // Update tap and passive values with the new multiplier var multiplier = TIERS[storage.currentTier].multiplier / TIERS[storage.currentTier - 1].multiplier; storage.tapValue = Math.floor(storage.tapValue * multiplier); storage.passiveIncome = Math.floor(storage.passiveIncome * multiplier); // Replace the current business with the new one var oldBusiness = currentBusiness; currentBusiness = new Business(storage.currentTier, TIERS[storage.currentTier].name); currentBusiness.x = oldBusiness.x; currentBusiness.y = oldBusiness.y; game.addChild(currentBusiness); // Create a visual effect for the tier upgrade oldBusiness.destroy(); // Spawn celebration particles for (var i = 0; i < 20; i++) { currentBusiness.createCoinParticle(); } updateUI(); LK.getSound('tier_upgrade').play(); } }; // Initialize employees for (var i = 0; i < storage.employees; i++) { addEmployee(); } updateUI(); } function addEmployee() { var employee = new Employee(); employee.x = currentBusiness.x + (Math.random() * 400 - 200); employee.y = currentBusiness.y + (Math.random() * 400 - 200); var scale = 0.6 + Math.random() * 0.4; employee.scaleX = employee.scaleY = scale; game.addChild(employee); employees.push(employee); // Animate the employee appearing employee.alpha = 0; tween(employee, { alpha: 1 }, { duration: 500, easing: tween.easeOut }); } function calculateEmployeeValue() { return TIERS[storage.currentTier].multiplier; } function updateUI() { moneyText.setText("$" + formatNumber(storage.money)); passiveIncomeText.setText("$" + formatNumber(storage.passiveIncome) + "/sec"); tapValueText.setText("Tap value: $" + formatNumber(storage.tapValue)); employeeCountText.setText("Employees: " + storage.employees); employeeButton.setText("Hire Employee: $" + formatNumber(storage.employeeCost)); upgradeButton.setText("Upgrade Tap: $" + formatNumber(storage.upgradeCost)); tierUpgradeButton.setText("Upgrade Business: $" + formatNumber(storage.tierUpgradeCost)); // Update button states employeeButton.setEnabled(storage.money >= storage.employeeCost); upgradeButton.setEnabled(storage.money >= storage.upgradeCost); tierUpgradeButton.setEnabled(storage.money >= storage.tierUpgradeCost && storage.currentTier < TIERS.length - 1); // Hide tier upgrade button if at max tier tierUpgradeButton.visible = storage.currentTier < TIERS.length - 1; } function formatNumber(num) { if (num < 1000) { return Math.floor(num).toString(); } else if (num < 1000000) { return (Math.floor(num / 10) / 100).toFixed(2) + "K"; } else if (num < 1000000000) { return (Math.floor(num / 10000) / 100).toFixed(2) + "M"; } else { return (Math.floor(num / 10000000) / 100).toFixed(2) + "B"; } } // Main game update loop game.update = function () { // Calculate passive income based on time since last update var currentTime = Date.now(); var deltaTime = (currentTime - lastUpdateTime) / 1000; // Convert to seconds lastUpdateTime = currentTime; if (storage.passiveIncome > 0 && deltaTime > 0 && deltaTime < 10) { // Cap at 10 seconds to prevent huge jumps var earned = storage.passiveIncome * deltaTime; storage.money += earned; storage.totalMoney += earned; } // Every few seconds, show floating income from passive if (LK.ticks % 120 === 0 && storage.passiveIncome > 0) { currentBusiness.showFloatingText("$" + formatNumber(storage.passiveIncome) + "/sec"); } // Update UI periodically (not every frame for performance) if (LK.ticks % 30 === 0) { updateUI(); } }; // Handle window resize & orientation changes game.resize = function () { updateUI(); }; // Initialize the game initUI(); lastUpdateTime = Date.now();
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
money: 0,
totalMoney: 0,
currentTier: 0,
tapValue: 1,
passiveIncome: 0,
employees: 0,
employeeCost: 10,
upgradeCost: 100,
tierUpgradeCost: 1000
});
/****
* Classes
****/
var Business = Container.expand(function (tier, name, color) {
var self = Container.call(this);
self.tier = tier;
self.name = name;
var assetId = ['lemonadeStand', 'bakery', 'restaurant', 'groceryStore', 'shoppingMall', 'corporation', 'globalConglomerate'][tier];
var businessGraphic = self.attachAsset(assetId, {
anchorX: 0.5,
anchorY: 0.5
});
if (assetId === 'groceryStore') {
businessGraphic.scaleX = 2;
businessGraphic.scaleY = 2;
}
var nameText = new Text2(name, {
size: 50,
fill: 0xFFFFFF,
font: "Comic Sans MS"
});
nameText.anchor.set(0.5, 0);
nameText.y = businessGraphic.height / 2 + 20;
self.addChild(nameText);
self.down = function (x, y, obj) {
self.tapBusiness();
LK.getSound('tap').play();
// Create coin particle effect
self.createCoinParticle();
};
self.tapBusiness = function () {
var moneyEarned = storage.tapValue;
storage.money += moneyEarned;
storage.totalMoney += moneyEarned;
// Show floating text effect
self.showFloatingText("+" + moneyEarned);
};
self.showFloatingText = function (text) {
var floatingText = new Text2(text, {
size: 50,
fill: 0xFFFF00,
font: "Comic Sans MS"
});
floatingText.anchor.set(0.5, 0.5);
floatingText.x = 0;
floatingText.y = -50;
self.addChild(floatingText);
// Animate the text floating up and fading
tween(floatingText, {
y: -150,
alpha: 0
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
floatingText.destroy();
}
});
};
self.createCoinParticle = function () {
var particle = LK.getAsset('coinParticle', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0
});
self.addChild(particle);
var angle = Math.random() * Math.PI * 2;
var distance = 100 + Math.random() * 100;
var targetX = Math.cos(angle) * distance;
var targetY = Math.sin(angle) * distance;
tween(particle, {
x: targetX,
y: targetY,
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 800,
easing: tween.easeOut,
onFinish: function onFinish() {
particle.destroy();
}
});
};
// Visual bounce effect when tapped
self.bounce = function () {
tween.stop(businessGraphic, {
scaleX: true,
scaleY: true
});
businessGraphic.scaleX = businessGraphic.scaleY = 0.9;
tween(businessGraphic, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
easing: tween.elasticOut
});
};
return self;
});
var Button = Container.expand(function (width, height, color, text, textSize, textColor) {
var self = Container.call(this);
var buttonShape = LK.getAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5,
width: width,
height: height,
tint: color || 0x4477FF
});
self.addChild(buttonShape);
var buttonText = new Text2(text || "", {
size: textSize || 40,
fill: textColor || "#FFFFFF"
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.setText = function (newText) {
buttonText.setText(newText);
};
self.setEnabled = function (enabled) {
self.enabled = enabled;
buttonShape.alpha = enabled ? 1.0 : 0.5;
};
self.down = function (x, y, obj) {
if (self.enabled !== false) {
tween.stop(buttonShape, {
scaleX: true,
scaleY: true
});
buttonShape.scaleX = buttonShape.scaleY = 0.9;
if (self.onPress) {
self.onPress();
}
}
};
self.up = function (x, y, obj) {
tween(buttonShape, {
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.easeOut
});
};
self.enabled = true;
return self;
});
var CoinParticle = Container.expand(function () {
var self = Container.call(this);
var coinGraphic = self.attachAsset('coinParticle', {
anchorX: 0.5,
anchorY: 0.5
});
return self;
});
var Employee = Container.expand(function () {
var self = Container.call(this);
var employeeGraphic = self.attachAsset('employee', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
self.update = function () {
self.rotation += 0.01;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x333333
});
/****
* Game Code
****/
// Game constants
var TIERS = [{
name: "Lemonade Stand",
multiplier: 1
}, {
name: "Bakery",
multiplier: 3
}, {
name: "Restaurant",
multiplier: 7
}, {
name: "Grocery Store",
multiplier: 15
}, {
name: "Shopping Mall",
multiplier: 40
}, {
name: "Corporation",
multiplier: 100
}, {
name: "Global Conglomerate",
multiplier: 300
}];
// Main game variables
var currentBusiness;
var moneyText;
var passiveIncomeText;
var tapValueText;
var employeeCountText;
var employeeButton;
var upgradeButton;
var tierUpgradeButton;
var employees = [];
var lastUpdateTime = Date.now();
// Initialize the UI
function initUI() {
// Initialize the UI
LK.playMusic('bgMusic'); // Play background music when the game starts
var background = LK.getAsset('background', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(background);
storage.money = 0; // Reset money to 0
storage.employees = 0; // Reset employees to 0
storage.tapValue = 1; // Reset tap value to 1
storage.passiveIncome = 0; // Set passive income to 0
storage.currentTier = 0; // Reset to initial tier
storage.employeeCost = 10; // Reset employee cost to original
storage.upgradeCost = 100; // Reset upgrade cost to original
storage.tierUpgradeCost = 1000; // Reset tier upgrade cost to original
currentBusiness = new Business(storage.currentTier, TIERS[storage.currentTier].name);
currentBusiness.x = 2048 / 2;
currentBusiness.y = 2732 / 2 - 200;
game.addChild(currentBusiness);
// Money text display
moneyText = new Text2("$" + formatNumber(storage.money), {
size: 80,
fill: 0xFFFFFF,
font: "Comic Sans MS"
});
moneyText.anchor.set(0.5, 0);
LK.gui.top.addChild(moneyText);
moneyText.y = 50;
// Passive income display
passiveIncomeText = new Text2("$" + formatNumber(storage.passiveIncome) + "/sec", {
size: 40,
fill: 0xAAFFAA,
font: "Comic Sans MS"
});
passiveIncomeText.anchor.set(0.5, 0);
LK.gui.top.addChild(passiveIncomeText);
passiveIncomeText.y = 140;
// Tap value display
tapValueText = new Text2("Tap value: $" + formatNumber(storage.tapValue), {
size: 40,
fill: 0xAAAAFF,
font: "Comic Sans MS"
});
tapValueText.anchor.set(0.5, 0);
LK.gui.top.addChild(tapValueText);
tapValueText.y = 190;
// Employee count display
employeeCountText = new Text2("Employees: " + storage.employees, {
size: 40,
fill: 0xFFAAAA,
font: "Comic Sans MS"
});
employeeCountText.anchor.set(0.5, 0);
LK.gui.top.addChild(employeeCountText);
employeeCountText.y = 240;
// Hire employee button
employeeButton = new Button(480, 120, 0x4477FF, "Hire Employee: $" + formatNumber(storage.employeeCost), 35);
upgradeButton = new Button(480, 120, 0x44AA44, "Upgrade Tap: $" + formatNumber(storage.upgradeCost), 35);
tierUpgradeButton = new Button(480, 120, 0xAA4444, "Upgrade Business: $" + formatNumber(storage.tierUpgradeCost), 35);
employeeButton.x = 2048 / 2 - 450;
employeeButton.y = 2732 - 400;
game.addChild(employeeButton);
employeeButton.onPress = function () {
if (storage.money >= storage.employeeCost) {
storage.money -= storage.employeeCost;
storage.employees += 1;
storage.passiveIncome += calculateEmployeeValue();
storage.employeeCost = Math.floor(storage.employeeCost * 1.3);
addEmployee();
updateUI();
LK.getSound('upgrade').play();
}
};
// Upgrade tap value button
upgradeButton.x = 2048 / 2;
upgradeButton.y = 2732 - 400;
game.addChild(upgradeButton);
upgradeButton.onPress = function () {
if (storage.money >= storage.upgradeCost) {
storage.money -= storage.upgradeCost;
storage.tapValue = Math.floor(storage.tapValue * 2);
storage.upgradeCost = Math.floor(storage.upgradeCost * 2);
updateUI();
currentBusiness.bounce();
LK.getSound('upgrade').play();
}
};
// Upgrade business tier button
tierUpgradeButton.x = 2048 / 2 + 450;
tierUpgradeButton.y = 2732 - 400;
game.addChild(tierUpgradeButton);
tierUpgradeButton.onPress = function () {
if (storage.money >= storage.tierUpgradeCost && storage.currentTier < TIERS.length - 1) {
storage.money -= storage.tierUpgradeCost;
storage.currentTier += 1;
storage.tierUpgradeCost = Math.floor(storage.tierUpgradeCost * 5);
// Update tap and passive values with the new multiplier
var multiplier = TIERS[storage.currentTier].multiplier / TIERS[storage.currentTier - 1].multiplier;
storage.tapValue = Math.floor(storage.tapValue * multiplier);
storage.passiveIncome = Math.floor(storage.passiveIncome * multiplier);
// Replace the current business with the new one
var oldBusiness = currentBusiness;
currentBusiness = new Business(storage.currentTier, TIERS[storage.currentTier].name);
currentBusiness.x = oldBusiness.x;
currentBusiness.y = oldBusiness.y;
game.addChild(currentBusiness);
// Create a visual effect for the tier upgrade
oldBusiness.destroy();
// Spawn celebration particles
for (var i = 0; i < 20; i++) {
currentBusiness.createCoinParticle();
}
updateUI();
LK.getSound('tier_upgrade').play();
}
};
// Initialize employees
for (var i = 0; i < storage.employees; i++) {
addEmployee();
}
updateUI();
}
function addEmployee() {
var employee = new Employee();
employee.x = currentBusiness.x + (Math.random() * 400 - 200);
employee.y = currentBusiness.y + (Math.random() * 400 - 200);
var scale = 0.6 + Math.random() * 0.4;
employee.scaleX = employee.scaleY = scale;
game.addChild(employee);
employees.push(employee);
// Animate the employee appearing
employee.alpha = 0;
tween(employee, {
alpha: 1
}, {
duration: 500,
easing: tween.easeOut
});
}
function calculateEmployeeValue() {
return TIERS[storage.currentTier].multiplier;
}
function updateUI() {
moneyText.setText("$" + formatNumber(storage.money));
passiveIncomeText.setText("$" + formatNumber(storage.passiveIncome) + "/sec");
tapValueText.setText("Tap value: $" + formatNumber(storage.tapValue));
employeeCountText.setText("Employees: " + storage.employees);
employeeButton.setText("Hire Employee: $" + formatNumber(storage.employeeCost));
upgradeButton.setText("Upgrade Tap: $" + formatNumber(storage.upgradeCost));
tierUpgradeButton.setText("Upgrade Business: $" + formatNumber(storage.tierUpgradeCost));
// Update button states
employeeButton.setEnabled(storage.money >= storage.employeeCost);
upgradeButton.setEnabled(storage.money >= storage.upgradeCost);
tierUpgradeButton.setEnabled(storage.money >= storage.tierUpgradeCost && storage.currentTier < TIERS.length - 1);
// Hide tier upgrade button if at max tier
tierUpgradeButton.visible = storage.currentTier < TIERS.length - 1;
}
function formatNumber(num) {
if (num < 1000) {
return Math.floor(num).toString();
} else if (num < 1000000) {
return (Math.floor(num / 10) / 100).toFixed(2) + "K";
} else if (num < 1000000000) {
return (Math.floor(num / 10000) / 100).toFixed(2) + "M";
} else {
return (Math.floor(num / 10000000) / 100).toFixed(2) + "B";
}
}
// Main game update loop
game.update = function () {
// Calculate passive income based on time since last update
var currentTime = Date.now();
var deltaTime = (currentTime - lastUpdateTime) / 1000; // Convert to seconds
lastUpdateTime = currentTime;
if (storage.passiveIncome > 0 && deltaTime > 0 && deltaTime < 10) {
// Cap at 10 seconds to prevent huge jumps
var earned = storage.passiveIncome * deltaTime;
storage.money += earned;
storage.totalMoney += earned;
}
// Every few seconds, show floating income from passive
if (LK.ticks % 120 === 0 && storage.passiveIncome > 0) {
currentBusiness.showFloatingText("$" + formatNumber(storage.passiveIncome) + "/sec");
}
// Update UI periodically (not every frame for performance)
if (LK.ticks % 30 === 0) {
updateUI();
}
};
// Handle window resize & orientation changes
game.resize = function () {
updateUI();
};
// Initialize the game
initUI();
lastUpdateTime = Date.now();
outside plains with hills. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
circle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a grocery store. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
top view off an employee. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows