User prompt
It is still on the top left hand clrner, please fix this
User prompt
Make it so the frame that has rhe equipment upgrade and the staff upgrade appears in the middle of the screen
User prompt
Make it so when you press the marketing button, a screen shows yp asking you want you want to upgrade, make 4 button and they will be, quality which makes the video earn more subscribers, the second upgrade is membership, you can only buy it once and if yoi buy it, it increases the amount lf money you get from your videos, the third upgrade button is staff, the more times you buy the staff, the faster videos are automatically uploaded. The fourth button is equipment, this increases your quality and money income. Every tiem you buy it, it's price increases ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Meme Empire Tycoon
Initial prompt
Make a meme empire game
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { money: 100, followers: 0, memeLevel: 1, studioLevel: 1, staffLevel: 0, marketingLevel: 0, autoEarningRate: 0, lastPlayed: undefined }); /**** * Classes ****/ var Button = Container.expand(function (text, width, height, color) { var self = Container.call(this); var buttonShape = self.attachAsset('button', { width: width || 300, height: height || 80, color: color || 0x4CAF50, anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 32, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.setText = function (newText) { buttonText.setText(newText); }; self.setColor = function (newColor) { buttonShape.tint = newColor; }; self.down = function (x, y, obj) { tween(buttonShape, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); LK.getSound('click').play(); }; self.up = function (x, y, obj) { tween(buttonShape, { scaleX: 1, scaleY: 1 }, { duration: 100 }); }; return self; }); var MemeStudio = Container.expand(function () { var self = Container.call(this); var studioBackground = self.attachAsset('studioBackground', { anchorX: 0.5, anchorY: 0.5 }); var memeCanvas = self.attachAsset('memeCanvas', { anchorX: 0.5, anchorY: 0.5, y: -250 }); var memeText = new Text2("Your Meme Here", { size: 36, fill: 0x000000 }); memeText.anchor.set(0.5, 0.5); memeText.y = -250; self.addChild(memeText); var createButton = new Button("Create Meme!", 350, 100, 0x4CAF50); createButton.y = 100; self.addChild(createButton); var earningsText = new Text2("Earnings: $0", { size: 32, fill: 0x333333 }); earningsText.anchor.set(0.5, 0.5); earningsText.y = 200; self.addChild(earningsText); var followerGainText = new Text2("+0 followers", { size: 28, fill: 0xFF5733 }); followerGainText.anchor.set(0.5, 0.5); followerGainText.y = 250; followerGainText.alpha = 0; self.addChild(followerGainText); // Update the meme canvas based on current studio level self.updateMemeQuality = function (level) { var quality = ["Potato Quality", "Standard Meme", "HD Meme", "Ultra HD Meme", "Viral-Ready Meme"]; var colors = [0xCCCCCC, 0xFFFFFF, 0xFFFFDD, 0xDDFFFF, 0xFFDDFF]; if (level > quality.length) { level = quality.length; } memeText.setText(quality[level - 1]); memeCanvas.tint = colors[level - 1]; // Scale the meme canvas slightly with each level var scale = 1 + (level - 1) * 0.1; memeCanvas.scale.set(scale, scale); }; // Show the earnings animation self.showEarnings = function (amount, followers) { earningsText.setText("Earnings: $" + amount); tween(earningsText, { scaleX: 1.3, scaleY: 1.3 }, { duration: 300, onFinish: function onFinish() { tween(earningsText, { scaleX: 1, scaleY: 1 }, { duration: 300 }); } }); if (followers > 0) { followerGainText.setText("+" + followers + " followers"); followerGainText.alpha = 1; tween(followerGainText, { y: 230, alpha: 0 }, { duration: 1500 }); } }; self.setCreateButtonCallback = function (callback) { createButton.up = function (x, y, obj) { tween(createButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (callback) { callback(); } }; }; return self; }); var TabSystem = Container.expand(function (tabs) { var self = Container.call(this); var tabButtons = []; var tabContents = []; var activeTab = 0; // Create tab buttons for (var i = 0; i < tabs.length; i++) { var tab = tabs[i]; var index = i; var tabButton = new Button(tab.name, 200, 60, 0x607D8B); tabButton.x = i * 220 - (tabs.length - 1) * 110; tabButton.y = -1300 / 2 + 30; tabButton.up = function (x, y, obj) { tween(tabButton, { scaleX: 1, scaleY: 1 }, { duration: 100 }); setActiveTab(index); }; self.addChild(tabButton); tabButtons.push(tabButton); // Create and add content container var content = tab.content; content.visible = i === 0; // Only first tab visible initially self.addChild(content); tabContents.push(content); } function setActiveTab(index) { if (index === activeTab) { return; } // Update button colors tabButtons[activeTab].setColor(0x607D8B); tabButtons[index].setColor(0x2196F3); // Hide old content, show new tabContents[activeTab].visible = false; tabContents[index].visible = true; activeTab = index; } // Initialize first tab as active setActiveTab(0); return self; }); var UpgradeButton = Container.expand(function (title, description, price, level, onUpgrade) { var self = Container.call(this); var buttonShape = self.attachAsset('upgradeButton', { anchorX: 0.5, anchorY: 0.5 }); var titleText = new Text2(title, { size: 28, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.y = -buttonShape.height / 2 + 15; self.addChild(titleText); var descText = new Text2(description, { size: 20, fill: 0xFFFFFF }); descText.anchor.set(0.5, 0); descText.y = -buttonShape.height / 2 + 50; self.addChild(descText); var levelText = new Text2("Level: " + level, { size: 22, fill: 0xFFD700 }); levelText.anchor.set(0, 1); levelText.x = -buttonShape.width / 2 + 15; levelText.y = buttonShape.height / 2 - 10; self.addChild(levelText); var priceText = new Text2("$" + price, { size: 24, fill: 0xFFD700 }); priceText.anchor.set(1, 1); priceText.x = buttonShape.width / 2 - 15; priceText.y = buttonShape.height / 2 - 10; self.addChild(priceText); self.updateLevel = function (newLevel) { levelText.setText("Level: " + newLevel); }; self.updatePrice = function (newPrice) { priceText.setText("$" + newPrice); }; self.disable = function () { buttonShape.tint = 0x888888; self.interactive = false; }; self.enable = function () { buttonShape.tint = 0x2196F3; self.interactive = true; }; self.down = function (x, y, obj) { tween(buttonShape, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); LK.getSound('click').play(); }; self.up = function (x, y, obj) { tween(buttonShape, { scaleX: 1, scaleY: 1 }, { duration: 100 }); if (onUpgrade) { onUpgrade(); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ // Game variables var money = storage.money || 100; var followers = storage.followers || 0; var memeLevel = storage.memeLevel || 1; var studioLevel = storage.studioLevel || 1; var staffLevel = storage.staffLevel || 0; var marketingLevel = storage.marketingLevel || 0; var autoEarningRate = storage.autoEarningRate || 0; var lastPlayed = storage.lastPlayed || Date.now(); // Constants var MEME_BASE_INCOME = 10; var MEME_BASE_FOLLOWERS = 5; var UPGRADE_BASE_COST = 100; var AUTO_EARNINGS_INTERVAL = 5000; // ms var OFFLINE_EARNINGS_MAX_HOURS = 24; // Calculate offline earnings function calculateOfflineEarnings() { var now = Date.now(); var timeDiff = now - lastPlayed; var hoursDiff = timeDiff / (1000 * 60 * 60); // Cap at max hours if (hoursDiff > OFFLINE_EARNINGS_MAX_HOURS) { hoursDiff = OFFLINE_EARNINGS_MAX_HOURS; } // Only calculate if we have auto earnings if (autoEarningRate > 0 && hoursDiff > 0) { var earnings = Math.floor(autoEarningRate * hoursDiff); money += earnings; // Show welcome back message here if needed console.log("Welcome back! You earned $" + earnings + " while away."); } lastPlayed = now; storage.lastPlayed = now; } // Calculate costs for upgrades function calculateUpgradeCost(baseLevel, currentLevel) { return Math.floor(UPGRADE_BASE_COST * baseLevel * Math.pow(1.5, currentLevel)); } // Update storage function updateStorage() { storage.money = money; storage.followers = followers; storage.memeLevel = memeLevel; storage.studioLevel = studioLevel; storage.staffLevel = staffLevel; storage.marketingLevel = marketingLevel; storage.autoEarningRate = autoEarningRate; } // Calculate meme creation result function createMeme() { // Base earnings affected by meme quality and studio level var earnings = MEME_BASE_INCOME * memeLevel * (1 + studioLevel * 0.5); // Followers gained affected by marketing level var newFollowers = Math.floor(MEME_BASE_FOLLOWERS * (1 + marketingLevel * 0.5)); // Boost from followers (virality factor) var followerBoost = 1 + followers / 1000; earnings = Math.floor(earnings * followerBoost); // Apply randomness for variability (80% to 120% of calculated value) var randomFactor = 0.8 + Math.random() * 0.4; earnings = Math.floor(earnings * randomFactor); // Small chance for meme to go viral if (Math.random() < 0.05) { earnings *= 5; newFollowers *= 3; console.log("Your meme went viral!"); } // Update game state money += earnings; followers += newFollowers; // Update storage updateStorage(); // Return results return { earnings: earnings, followers: newFollowers }; } // Update auto earnings rate based on staff function updateAutoEarningRate() { autoEarningRate = staffLevel * 5 * memeLevel; storage.autoEarningRate = autoEarningRate; } // Create UI elements // Main studio var memeStudio = new MemeStudio(); memeStudio.x = 2048 / 2; memeStudio.y = 2732 / 2; game.addChild(memeStudio); // Initialize with current meme quality memeStudio.updateMemeQuality(memeLevel); // Stats display var statsContainer = new Container(); statsContainer.x = 2048 / 2; statsContainer.y = 180; game.addChild(statsContainer); var moneyIcon = LK.getAsset('moneyIcon', { anchorX: 0.5, anchorY: 0.5, x: -150 }); statsContainer.addChild(moneyIcon); var moneyText = new Text2("$" + money, { size: 36, fill: 0x000000 }); moneyText.anchor.set(0, 0.5); moneyText.x = -120; statsContainer.addChild(moneyText); var followerIcon = LK.getAsset('followerIcon', { anchorX: 0.5, anchorY: 0.5, x: 50 }); statsContainer.addChild(followerIcon); var followerText = new Text2(followers + " followers", { size: 36, fill: 0x000000 }); followerText.anchor.set(0, 0.5); followerText.x = 80; statsContainer.addChild(followerText); var autoEarningText = new Text2("", { size: 24, fill: 0x333333 }); autoEarningText.anchor.set(0.5, 0.5); autoEarningText.y = 40; statsContainer.addChild(autoEarningText); // Create upgrade tab contents var studioContent = new Container(); // Meme Quality Upgrade var memeUpgradeButton = new UpgradeButton("Meme Quality", "Better memes = more $$$", calculateUpgradeCost(1, memeLevel), memeLevel, function () { var cost = calculateUpgradeCost(1, memeLevel); if (money >= cost) { money -= cost; memeLevel++; memeUpgradeButton.updateLevel(memeLevel); memeUpgradeButton.updatePrice(calculateUpgradeCost(1, memeLevel)); memeStudio.updateMemeQuality(memeLevel); updateAutoEarningRate(); updateStorage(); LK.getSound('levelUp').play(); } }); memeUpgradeButton.x = -350; memeUpgradeButton.y = 0; studioContent.addChild(memeUpgradeButton); // Studio Upgrade var studioUpgradeButton = new UpgradeButton("Studio Equipment", "Better equipment = better production", calculateUpgradeCost(2, studioLevel), studioLevel, function () { var cost = calculateUpgradeCost(2, studioLevel); if (money >= cost) { money -= cost; studioLevel++; studioUpgradeButton.updateLevel(studioLevel); studioUpgradeButton.updatePrice(calculateUpgradeCost(2, studioLevel)); updateStorage(); LK.getSound('levelUp').play(); } }); studioUpgradeButton.x = 0; studioUpgradeButton.y = 0; studioContent.addChild(studioUpgradeButton); // Staff Upgrade var staffUpgradeButton = new UpgradeButton("Hire Staff", "More staff = passive income", calculateUpgradeCost(3, staffLevel), staffLevel, function () { var cost = calculateUpgradeCost(3, staffLevel); if (money >= cost) { money -= cost; staffLevel++; staffUpgradeButton.updateLevel(staffLevel); staffUpgradeButton.updatePrice(calculateUpgradeCost(3, staffLevel)); updateAutoEarningRate(); updateStorage(); LK.getSound('levelUp').play(); } }); staffUpgradeButton.x = 350; staffUpgradeButton.y = 0; studioContent.addChild(staffUpgradeButton); // Marketing Content var marketingContent = new Container(); // Marketing Upgrade var marketingUpgradeButton = new UpgradeButton("Marketing", "Better marketing = more followers", calculateUpgradeCost(2, marketingLevel), marketingLevel, function () { var cost = calculateUpgradeCost(2, marketingLevel); if (money >= cost) { money -= cost; marketingLevel++; marketingUpgradeButton.updateLevel(marketingLevel); marketingUpgradeButton.updatePrice(calculateUpgradeCost(2, marketingLevel)); updateStorage(); LK.getSound('levelUp').play(); } }); marketingUpgradeButton.x = 0; marketingUpgradeButton.y = 0; marketingContent.addChild(marketingUpgradeButton); // Create and add tab system var tabSystem = new TabSystem([{ name: "Studio", content: studioContent }, { name: "Marketing", content: marketingContent }]); tabSystem.x = 2048 / 2; tabSystem.y = 2732 / 2 + 400; game.addChild(tabSystem); // Set callback for create meme button memeStudio.setCreateButtonCallback(function () { var result = createMeme(); memeStudio.showEarnings(result.earnings, result.followers); LK.getSound('coin').play(); }); // Start background music LK.playMusic('bgMusic', { fade: { start: 0, end: 0.4, duration: 1000 } }); // Calculate any offline earnings when game starts calculateOfflineEarnings(); // Set up auto earning timer var lastAutoEarningTime = Date.now(); // Update UI with current values function updateUI() { moneyText.setText("$" + Math.floor(money)); followerText.setText(Math.floor(followers) + " followers"); if (autoEarningRate > 0) { autoEarningText.setText("Auto earning: $" + autoEarningRate + " / hour"); } else { autoEarningText.setText(""); } } // Main game update loop game.update = function () { // Handle auto earnings var now = Date.now(); var elapsed = now - lastAutoEarningTime; if (elapsed >= AUTO_EARNINGS_INTERVAL && autoEarningRate > 0) { // Calculate earnings for this period var hourFraction = elapsed / (1000 * 60 * 60); var earnings = Math.floor(autoEarningRate * hourFraction); if (earnings > 0) { money += earnings; lastAutoEarningTime = now; updateStorage(); } } // Update UI elements updateUI(); // Enable/disable upgrade buttons based on available money if (money >= calculateUpgradeCost(1, memeLevel)) { memeUpgradeButton.enable(); } else { memeUpgradeButton.disable(); } if (money >= calculateUpgradeCost(2, studioLevel)) { studioUpgradeButton.enable(); } else { studioUpgradeButton.disable(); } if (money >= calculateUpgradeCost(3, staffLevel)) { staffUpgradeButton.enable(); } else { staffUpgradeButton.disable(); } if (money >= calculateUpgradeCost(2, marketingLevel)) { marketingUpgradeButton.enable(); } else { marketingUpgradeButton.disable(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,551 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1", {
+ money: 100,
+ followers: 0,
+ memeLevel: 1,
+ studioLevel: 1,
+ staffLevel: 0,
+ marketingLevel: 0,
+ autoEarningRate: 0,
+ lastPlayed: undefined
+});
+
+/****
+* Classes
+****/
+var Button = Container.expand(function (text, width, height, color) {
+ var self = Container.call(this);
+ var buttonShape = self.attachAsset('button', {
+ width: width || 300,
+ height: height || 80,
+ color: color || 0x4CAF50,
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var buttonText = new Text2(text, {
+ size: 32,
+ fill: 0xFFFFFF
+ });
+ buttonText.anchor.set(0.5, 0.5);
+ self.addChild(buttonText);
+ self.setText = function (newText) {
+ buttonText.setText(newText);
+ };
+ self.setColor = function (newColor) {
+ buttonShape.tint = newColor;
+ };
+ self.down = function (x, y, obj) {
+ tween(buttonShape, {
+ scaleX: 0.95,
+ scaleY: 0.95
+ }, {
+ duration: 100
+ });
+ LK.getSound('click').play();
+ };
+ self.up = function (x, y, obj) {
+ tween(buttonShape, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ };
+ return self;
+});
+var MemeStudio = Container.expand(function () {
+ var self = Container.call(this);
+ var studioBackground = self.attachAsset('studioBackground', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var memeCanvas = self.attachAsset('memeCanvas', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: -250
+ });
+ var memeText = new Text2("Your Meme Here", {
+ size: 36,
+ fill: 0x000000
+ });
+ memeText.anchor.set(0.5, 0.5);
+ memeText.y = -250;
+ self.addChild(memeText);
+ var createButton = new Button("Create Meme!", 350, 100, 0x4CAF50);
+ createButton.y = 100;
+ self.addChild(createButton);
+ var earningsText = new Text2("Earnings: $0", {
+ size: 32,
+ fill: 0x333333
+ });
+ earningsText.anchor.set(0.5, 0.5);
+ earningsText.y = 200;
+ self.addChild(earningsText);
+ var followerGainText = new Text2("+0 followers", {
+ size: 28,
+ fill: 0xFF5733
+ });
+ followerGainText.anchor.set(0.5, 0.5);
+ followerGainText.y = 250;
+ followerGainText.alpha = 0;
+ self.addChild(followerGainText);
+ // Update the meme canvas based on current studio level
+ self.updateMemeQuality = function (level) {
+ var quality = ["Potato Quality", "Standard Meme", "HD Meme", "Ultra HD Meme", "Viral-Ready Meme"];
+ var colors = [0xCCCCCC, 0xFFFFFF, 0xFFFFDD, 0xDDFFFF, 0xFFDDFF];
+ if (level > quality.length) {
+ level = quality.length;
+ }
+ memeText.setText(quality[level - 1]);
+ memeCanvas.tint = colors[level - 1];
+ // Scale the meme canvas slightly with each level
+ var scale = 1 + (level - 1) * 0.1;
+ memeCanvas.scale.set(scale, scale);
+ };
+ // Show the earnings animation
+ self.showEarnings = function (amount, followers) {
+ earningsText.setText("Earnings: $" + amount);
+ tween(earningsText, {
+ scaleX: 1.3,
+ scaleY: 1.3
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ tween(earningsText, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 300
+ });
+ }
+ });
+ if (followers > 0) {
+ followerGainText.setText("+" + followers + " followers");
+ followerGainText.alpha = 1;
+ tween(followerGainText, {
+ y: 230,
+ alpha: 0
+ }, {
+ duration: 1500
+ });
+ }
+ };
+ self.setCreateButtonCallback = function (callback) {
+ createButton.up = function (x, y, obj) {
+ tween(createButton, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ if (callback) {
+ callback();
+ }
+ };
+ };
+ return self;
+});
+var TabSystem = Container.expand(function (tabs) {
+ var self = Container.call(this);
+ var tabButtons = [];
+ var tabContents = [];
+ var activeTab = 0;
+ // Create tab buttons
+ for (var i = 0; i < tabs.length; i++) {
+ var tab = tabs[i];
+ var index = i;
+ var tabButton = new Button(tab.name, 200, 60, 0x607D8B);
+ tabButton.x = i * 220 - (tabs.length - 1) * 110;
+ tabButton.y = -1300 / 2 + 30;
+ tabButton.up = function (x, y, obj) {
+ tween(tabButton, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ setActiveTab(index);
+ };
+ self.addChild(tabButton);
+ tabButtons.push(tabButton);
+ // Create and add content container
+ var content = tab.content;
+ content.visible = i === 0; // Only first tab visible initially
+ self.addChild(content);
+ tabContents.push(content);
+ }
+ function setActiveTab(index) {
+ if (index === activeTab) {
+ return;
+ }
+ // Update button colors
+ tabButtons[activeTab].setColor(0x607D8B);
+ tabButtons[index].setColor(0x2196F3);
+ // Hide old content, show new
+ tabContents[activeTab].visible = false;
+ tabContents[index].visible = true;
+ activeTab = index;
+ }
+ // Initialize first tab as active
+ setActiveTab(0);
+ return self;
+});
+var UpgradeButton = Container.expand(function (title, description, price, level, onUpgrade) {
+ var self = Container.call(this);
+ var buttonShape = self.attachAsset('upgradeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var titleText = new Text2(title, {
+ size: 28,
+ fill: 0xFFFFFF
+ });
+ titleText.anchor.set(0.5, 0);
+ titleText.y = -buttonShape.height / 2 + 15;
+ self.addChild(titleText);
+ var descText = new Text2(description, {
+ size: 20,
+ fill: 0xFFFFFF
+ });
+ descText.anchor.set(0.5, 0);
+ descText.y = -buttonShape.height / 2 + 50;
+ self.addChild(descText);
+ var levelText = new Text2("Level: " + level, {
+ size: 22,
+ fill: 0xFFD700
+ });
+ levelText.anchor.set(0, 1);
+ levelText.x = -buttonShape.width / 2 + 15;
+ levelText.y = buttonShape.height / 2 - 10;
+ self.addChild(levelText);
+ var priceText = new Text2("$" + price, {
+ size: 24,
+ fill: 0xFFD700
+ });
+ priceText.anchor.set(1, 1);
+ priceText.x = buttonShape.width / 2 - 15;
+ priceText.y = buttonShape.height / 2 - 10;
+ self.addChild(priceText);
+ self.updateLevel = function (newLevel) {
+ levelText.setText("Level: " + newLevel);
+ };
+ self.updatePrice = function (newPrice) {
+ priceText.setText("$" + newPrice);
+ };
+ self.disable = function () {
+ buttonShape.tint = 0x888888;
+ self.interactive = false;
+ };
+ self.enable = function () {
+ buttonShape.tint = 0x2196F3;
+ self.interactive = true;
+ };
+ self.down = function (x, y, obj) {
+ tween(buttonShape, {
+ scaleX: 0.95,
+ scaleY: 0.95
+ }, {
+ duration: 100
+ });
+ LK.getSound('click').play();
+ };
+ self.up = function (x, y, obj) {
+ tween(buttonShape, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100
+ });
+ if (onUpgrade) {
+ onUpgrade();
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var money = storage.money || 100;
+var followers = storage.followers || 0;
+var memeLevel = storage.memeLevel || 1;
+var studioLevel = storage.studioLevel || 1;
+var staffLevel = storage.staffLevel || 0;
+var marketingLevel = storage.marketingLevel || 0;
+var autoEarningRate = storage.autoEarningRate || 0;
+var lastPlayed = storage.lastPlayed || Date.now();
+// Constants
+var MEME_BASE_INCOME = 10;
+var MEME_BASE_FOLLOWERS = 5;
+var UPGRADE_BASE_COST = 100;
+var AUTO_EARNINGS_INTERVAL = 5000; // ms
+var OFFLINE_EARNINGS_MAX_HOURS = 24;
+// Calculate offline earnings
+function calculateOfflineEarnings() {
+ var now = Date.now();
+ var timeDiff = now - lastPlayed;
+ var hoursDiff = timeDiff / (1000 * 60 * 60);
+ // Cap at max hours
+ if (hoursDiff > OFFLINE_EARNINGS_MAX_HOURS) {
+ hoursDiff = OFFLINE_EARNINGS_MAX_HOURS;
+ }
+ // Only calculate if we have auto earnings
+ if (autoEarningRate > 0 && hoursDiff > 0) {
+ var earnings = Math.floor(autoEarningRate * hoursDiff);
+ money += earnings;
+ // Show welcome back message here if needed
+ console.log("Welcome back! You earned $" + earnings + " while away.");
+ }
+ lastPlayed = now;
+ storage.lastPlayed = now;
+}
+// Calculate costs for upgrades
+function calculateUpgradeCost(baseLevel, currentLevel) {
+ return Math.floor(UPGRADE_BASE_COST * baseLevel * Math.pow(1.5, currentLevel));
+}
+// Update storage
+function updateStorage() {
+ storage.money = money;
+ storage.followers = followers;
+ storage.memeLevel = memeLevel;
+ storage.studioLevel = studioLevel;
+ storage.staffLevel = staffLevel;
+ storage.marketingLevel = marketingLevel;
+ storage.autoEarningRate = autoEarningRate;
+}
+// Calculate meme creation result
+function createMeme() {
+ // Base earnings affected by meme quality and studio level
+ var earnings = MEME_BASE_INCOME * memeLevel * (1 + studioLevel * 0.5);
+ // Followers gained affected by marketing level
+ var newFollowers = Math.floor(MEME_BASE_FOLLOWERS * (1 + marketingLevel * 0.5));
+ // Boost from followers (virality factor)
+ var followerBoost = 1 + followers / 1000;
+ earnings = Math.floor(earnings * followerBoost);
+ // Apply randomness for variability (80% to 120% of calculated value)
+ var randomFactor = 0.8 + Math.random() * 0.4;
+ earnings = Math.floor(earnings * randomFactor);
+ // Small chance for meme to go viral
+ if (Math.random() < 0.05) {
+ earnings *= 5;
+ newFollowers *= 3;
+ console.log("Your meme went viral!");
+ }
+ // Update game state
+ money += earnings;
+ followers += newFollowers;
+ // Update storage
+ updateStorage();
+ // Return results
+ return {
+ earnings: earnings,
+ followers: newFollowers
+ };
+}
+// Update auto earnings rate based on staff
+function updateAutoEarningRate() {
+ autoEarningRate = staffLevel * 5 * memeLevel;
+ storage.autoEarningRate = autoEarningRate;
+}
+// Create UI elements
+// Main studio
+var memeStudio = new MemeStudio();
+memeStudio.x = 2048 / 2;
+memeStudio.y = 2732 / 2;
+game.addChild(memeStudio);
+// Initialize with current meme quality
+memeStudio.updateMemeQuality(memeLevel);
+// Stats display
+var statsContainer = new Container();
+statsContainer.x = 2048 / 2;
+statsContainer.y = 180;
+game.addChild(statsContainer);
+var moneyIcon = LK.getAsset('moneyIcon', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -150
+});
+statsContainer.addChild(moneyIcon);
+var moneyText = new Text2("$" + money, {
+ size: 36,
+ fill: 0x000000
+});
+moneyText.anchor.set(0, 0.5);
+moneyText.x = -120;
+statsContainer.addChild(moneyText);
+var followerIcon = LK.getAsset('followerIcon', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 50
+});
+statsContainer.addChild(followerIcon);
+var followerText = new Text2(followers + " followers", {
+ size: 36,
+ fill: 0x000000
+});
+followerText.anchor.set(0, 0.5);
+followerText.x = 80;
+statsContainer.addChild(followerText);
+var autoEarningText = new Text2("", {
+ size: 24,
+ fill: 0x333333
+});
+autoEarningText.anchor.set(0.5, 0.5);
+autoEarningText.y = 40;
+statsContainer.addChild(autoEarningText);
+// Create upgrade tab contents
+var studioContent = new Container();
+// Meme Quality Upgrade
+var memeUpgradeButton = new UpgradeButton("Meme Quality", "Better memes = more $$$", calculateUpgradeCost(1, memeLevel), memeLevel, function () {
+ var cost = calculateUpgradeCost(1, memeLevel);
+ if (money >= cost) {
+ money -= cost;
+ memeLevel++;
+ memeUpgradeButton.updateLevel(memeLevel);
+ memeUpgradeButton.updatePrice(calculateUpgradeCost(1, memeLevel));
+ memeStudio.updateMemeQuality(memeLevel);
+ updateAutoEarningRate();
+ updateStorage();
+ LK.getSound('levelUp').play();
+ }
+});
+memeUpgradeButton.x = -350;
+memeUpgradeButton.y = 0;
+studioContent.addChild(memeUpgradeButton);
+// Studio Upgrade
+var studioUpgradeButton = new UpgradeButton("Studio Equipment", "Better equipment = better production", calculateUpgradeCost(2, studioLevel), studioLevel, function () {
+ var cost = calculateUpgradeCost(2, studioLevel);
+ if (money >= cost) {
+ money -= cost;
+ studioLevel++;
+ studioUpgradeButton.updateLevel(studioLevel);
+ studioUpgradeButton.updatePrice(calculateUpgradeCost(2, studioLevel));
+ updateStorage();
+ LK.getSound('levelUp').play();
+ }
+});
+studioUpgradeButton.x = 0;
+studioUpgradeButton.y = 0;
+studioContent.addChild(studioUpgradeButton);
+// Staff Upgrade
+var staffUpgradeButton = new UpgradeButton("Hire Staff", "More staff = passive income", calculateUpgradeCost(3, staffLevel), staffLevel, function () {
+ var cost = calculateUpgradeCost(3, staffLevel);
+ if (money >= cost) {
+ money -= cost;
+ staffLevel++;
+ staffUpgradeButton.updateLevel(staffLevel);
+ staffUpgradeButton.updatePrice(calculateUpgradeCost(3, staffLevel));
+ updateAutoEarningRate();
+ updateStorage();
+ LK.getSound('levelUp').play();
+ }
+});
+staffUpgradeButton.x = 350;
+staffUpgradeButton.y = 0;
+studioContent.addChild(staffUpgradeButton);
+// Marketing Content
+var marketingContent = new Container();
+// Marketing Upgrade
+var marketingUpgradeButton = new UpgradeButton("Marketing", "Better marketing = more followers", calculateUpgradeCost(2, marketingLevel), marketingLevel, function () {
+ var cost = calculateUpgradeCost(2, marketingLevel);
+ if (money >= cost) {
+ money -= cost;
+ marketingLevel++;
+ marketingUpgradeButton.updateLevel(marketingLevel);
+ marketingUpgradeButton.updatePrice(calculateUpgradeCost(2, marketingLevel));
+ updateStorage();
+ LK.getSound('levelUp').play();
+ }
+});
+marketingUpgradeButton.x = 0;
+marketingUpgradeButton.y = 0;
+marketingContent.addChild(marketingUpgradeButton);
+// Create and add tab system
+var tabSystem = new TabSystem([{
+ name: "Studio",
+ content: studioContent
+}, {
+ name: "Marketing",
+ content: marketingContent
+}]);
+tabSystem.x = 2048 / 2;
+tabSystem.y = 2732 / 2 + 400;
+game.addChild(tabSystem);
+// Set callback for create meme button
+memeStudio.setCreateButtonCallback(function () {
+ var result = createMeme();
+ memeStudio.showEarnings(result.earnings, result.followers);
+ LK.getSound('coin').play();
+});
+// Start background music
+LK.playMusic('bgMusic', {
+ fade: {
+ start: 0,
+ end: 0.4,
+ duration: 1000
+ }
+});
+// Calculate any offline earnings when game starts
+calculateOfflineEarnings();
+// Set up auto earning timer
+var lastAutoEarningTime = Date.now();
+// Update UI with current values
+function updateUI() {
+ moneyText.setText("$" + Math.floor(money));
+ followerText.setText(Math.floor(followers) + " followers");
+ if (autoEarningRate > 0) {
+ autoEarningText.setText("Auto earning: $" + autoEarningRate + " / hour");
+ } else {
+ autoEarningText.setText("");
+ }
+}
+// Main game update loop
+game.update = function () {
+ // Handle auto earnings
+ var now = Date.now();
+ var elapsed = now - lastAutoEarningTime;
+ if (elapsed >= AUTO_EARNINGS_INTERVAL && autoEarningRate > 0) {
+ // Calculate earnings for this period
+ var hourFraction = elapsed / (1000 * 60 * 60);
+ var earnings = Math.floor(autoEarningRate * hourFraction);
+ if (earnings > 0) {
+ money += earnings;
+ lastAutoEarningTime = now;
+ updateStorage();
+ }
+ }
+ // Update UI elements
+ updateUI();
+ // Enable/disable upgrade buttons based on available money
+ if (money >= calculateUpgradeCost(1, memeLevel)) {
+ memeUpgradeButton.enable();
+ } else {
+ memeUpgradeButton.disable();
+ }
+ if (money >= calculateUpgradeCost(2, studioLevel)) {
+ studioUpgradeButton.enable();
+ } else {
+ studioUpgradeButton.disable();
+ }
+ if (money >= calculateUpgradeCost(3, staffLevel)) {
+ staffUpgradeButton.enable();
+ } else {
+ staffUpgradeButton.disable();
+ }
+ if (money >= calculateUpgradeCost(2, marketingLevel)) {
+ marketingUpgradeButton.enable();
+ } else {
+ marketingUpgradeButton.disable();
+ }
+};
\ No newline at end of file
Modern App Store icon, high definition, square with rounded corners, for a game titled "Meme Empire Tycoon" and with the description "Build your meme empire from scratch in this addictive tycoon game! Create viral content, hire talented staff, upgrade your studio, and strategically expand your meme business across multiple platforms to become the internet's most influential meme creator.". No text on icon!
Green button. In-Game asset. 2d. High contrast. No shadows
Youtube silver play button. In-Game asset. 2d. High contrast. No shadows
Wheel of fortune. In-Game asset. 2d. High contrast. No shadows
Wheel of fortune without the stand. In-Game asset. 2d. High contrast. No shadows
Coin potion. In-Game asset. 2d. High contrast. No shadows
Diamond. In-Game asset. 2d. High contrast. No shadows
Archery target. In-Game asset. 2d. High contrast. No shadows
Arrow. In-Game asset. 2d. High contrast. No shadows
Fish. In-Game asset. 2d. High contrast. No shadows
Purple fish. In-Game asset. 2d. High contrast. No shadows
Golden fish. In-Game asset. 2d. High contrast. No shadows
Red cup. In-Game asset. 2d. High contrast. No shadows
Mute music logo. In-Game asset. 2d. High contrast. No shadows