Code edit (1 edits merged)
Please save this source code
User prompt
Egg Clicker Tycoon
Initial prompt
An Egg Clicker Where You Can Buy Egg Skins That Upgrade Your Egg points Per Click, Each get More Expensive and Better, The Best skin is The "Rainbow egg" Which Costs 1M Egg Points, You Can Also Trade Egg points For Coins To Get Auto-clicker Upgrades, Each Auto-clicker Upgrade Make The Auto-clicker Faster, Starts at 1 Egg Point Every 20 seconds, Maxes out at 1 Egg Point Every 0.5 seconds And 1 Coin Every 5 seconds (20 upgrades max) And The Game is Called "Egg"
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1", { eggPoints: 0, coins: 0, currentSkin: "basic", autoClickerLevel: 0 }); /**** * Classes ****/ var Egg = Container.expand(function () { var self = Container.call(this); // Properties self.skin = storage.currentSkin || 'basic'; self.pointsPerClick = getPointsPerClick(self.skin); // Create egg graphic based on current skin var eggGraphic = self.attachAsset(self.skin + 'Egg', { anchorX: 0.5, anchorY: 0.5, scaleX: 1, scaleY: 1 }); // Animation state self.isAnimating = false; // Click handler self.down = function (x, y, obj) { if (!self.isAnimating) { self.isAnimating = true; // Play tap sound LK.getSound('eggTap').play(); // Animate egg on tap tween(eggGraphic, { scaleX: 0.9, scaleY: 0.9 }, { duration: 100, onFinish: function onFinish() { tween(eggGraphic, { scaleX: 1, scaleY: 1 }, { duration: 100, onFinish: function onFinish() { self.isAnimating = false; } }); } }); // Add points addEggPoints(self.pointsPerClick); // Create floating number effect createFloatingPoints(self.pointsPerClick, x, y); } }; // Change skin method self.changeSkin = function (newSkin) { // Remove old graphic eggGraphic.destroy(); // Update skin and points self.skin = newSkin; self.pointsPerClick = getPointsPerClick(newSkin); // Create new graphic with updated skin eggGraphic = self.attachAsset(newSkin + 'Egg', { anchorX: 0.5, anchorY: 0.5 }); // Save current skin to storage storage.currentSkin = newSkin; // Flash to indicate upgrade LK.effects.flashObject(eggGraphic, 0xFFFFFF, 500); }; return self; }); var FloatingPoints = Container.expand(function (value, startX, startY) { var self = Container.call(this); // Position the container self.x = startX; self.y = startY; // Create text var text = self.addChild(new Text2("+" + value, { size: 40, fill: 0xFFCC00 })); text.anchor.set(0.5, 0.5); // Animate the floating points tween(self, { y: self.y - 100, alpha: 0 }, { duration: 1000, onFinish: function onFinish() { self.destroy(); } }); return self; }); var ShopItem = Container.expand(function (itemType, itemName, cost, description) { var self = Container.call(this); // Properties self.itemType = itemType; // "skin" or "autoClicker" self.itemName = itemName; self.cost = cost; self.description = description; self.purchased = false; // Create background var background = self.attachAsset('shopItemBg', { anchorX: 0.5, anchorY: 0.5 }); // Create icon var icon; if (itemType === "skin") { icon = self.attachAsset(itemName + 'Egg', { anchorX: 0.5, anchorY: 0.5, x: -150, scaleX: 0.6, scaleY: 0.6 }); } else { icon = self.attachAsset('autoClicker', { anchorX: 0.5, anchorY: 0.5, x: -150, scaleX: 0.6, scaleY: 0.6 }); } // Create item name text var nameText = self.addChild(new Text2(itemName, { size: 40, fill: 0x000000 })); nameText.anchor.set(0, 0.5); nameText.x = -70; nameText.y = -30; // Create description text var descText = self.addChild(new Text2(description, { size: 30, fill: 0x444444 })); descText.anchor.set(0, 0.5); descText.x = -70; descText.y = 10; // Create cost text var costText = self.addChild(new Text2((itemType === "skin" ? "๐ฅ " : "๐ฐ ") + cost, { size: 35, fill: 0x000000 })); costText.anchor.set(1, 0.5); costText.x = 170; costText.y = 0; // Click handler self.down = function () { if (self.itemType === "skin") { if (storage.eggPoints >= self.cost && storage.currentSkin !== self.itemName) { // Purchase skin storage.eggPoints -= self.cost; egg.changeSkin(self.itemName); LK.getSound('purchase').play(); updateUI(); } else if (storage.currentSkin === self.itemName) { // Already equipped LK.getSound('error').play(); } else { // Not enough points LK.getSound('error').play(); LK.effects.flashObject(costText, 0xFF0000, 300); } } else if (self.itemType === "autoClicker") { if (storage.coins >= self.cost && storage.autoClickerLevel < 20) { // Purchase auto-clicker upgrade storage.coins -= self.cost; storage.autoClickerLevel++; LK.getSound('purchase').play(); updateAutoClickerInfo(); updateUI(); } else if (storage.autoClickerLevel >= 20) { // Max level reached LK.getSound('error').play(); } else { // Not enough coins LK.getSound('error').play(); LK.effects.flashObject(costText, 0xFF0000, 300); } } }; return self; }); var ShopPanel = Container.expand(function (panelType) { var self = Container.call(this); // Properties self.panelType = panelType; // "skins" or "autoClicker" // Create background var background = self.attachAsset('shopPanelBg', { anchorX: 0.5, anchorY: 0.5 }); // Create title var title = self.addChild(new Text2(panelType === "skins" ? "Egg Skins" : "Auto-Clicker", { size: 60, fill: 0x000000 })); title.anchor.set(0.5, 0); title.y = -320; // Create items container var itemsContainer = self.addChild(new Container()); itemsContainer.y = -220; // Add shop items based on panel type if (panelType === "skins") { // Add skin items var skins = [{ name: "basic", cost: 0, desc: "Standard egg (1 pt/click)" }, { name: "golden", cost: 100, desc: "Fancy gold egg (5 pts/click)" }, { name: "spotted", cost: 500, desc: "Spotted egg (25 pts/click)" }, { name: "striped", cost: 2500, desc: "Striped egg (100 pts/click)" }, { name: "crystal", cost: 10000, desc: "Crystal egg (500 pts/click)" }, { name: "galaxy", cost: 50000, desc: "Cosmic egg (2,500 pts/click)" }, { name: "rainbow", cost: 1000000, desc: "Ultimate egg (100,000 pts/click)" }]; for (var i = 0; i < skins.length; i++) { var skin = skins[i]; var item = itemsContainer.addChild(new ShopItem("skin", skin.name, skin.cost, skin.desc)); item.y = i * 100; } } else { // Add auto-clicker info var infoBox = itemsContainer.attachAsset('infoBg', { anchorX: 0.5, anchorY: 0.5, y: -50 }); autoClickerInfoText = itemsContainer.addChild(new Text2("", { size: 35, fill: 0x000000 })); autoClickerInfoText.anchor.set(0.5, 0.5); autoClickerInfoText.y = -50; // Create upgrade button var upgradeItem = itemsContainer.addChild(new ShopItem("autoClicker", "Upgrade Auto-Clicker", getAutoClickerUpgradeCost(), "Level up your automatic egg tapper")); upgradeItem.y = 70; // Create convert button var convertButton = itemsContainer.attachAsset('convertButton', { anchorX: 0.5, anchorY: 0.5, y: 170 }); var convertText = itemsContainer.addChild(new Text2("Convert 1000 Points to 1 Coin", { size: 35, fill: 0xFFFFFF })); convertText.anchor.set(0.5, 0.5); convertText.y = 170; // Add convert button functionality convertButton.interactive = true; convertButton.down = function () { if (storage.eggPoints >= 1000) { storage.eggPoints -= 1000; storage.coins++; LK.getSound('convert').play(); updateUI(); } else { LK.getSound('error').play(); LK.effects.flashObject(convertText, 0xFF0000, 300); } }; } // Create close button var closeButton = self.attachAsset('closeButton', { anchorX: 0.5, anchorY: 0.5, x: 300, y: -320 }); closeButton.down = function () { self.visible = false; LK.getSound('click').play(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xF5F5F5 }); /**** * Game Code ****/ // Play background music // Assets will be initialized automatically based on usage // Initialize assets required for the game // Initialize sounds // Initialize music LK.playMusic('bgMusic'); // Game variables var lastAutoClickTime = Date.now(); var lastCoinGenerationTime = Date.now(); var egg; var eggPointsText; var coinsText; var skinsPanel; var autoClickerPanel; var autoClickerInfoText; // Initialize game elements initGame(); function initGame() { // Create egg egg = game.addChild(new Egg()); egg.x = 2048 / 2; egg.y = 2732 / 2; // Create UI elements createUI(); // Create shop panels createShopPanels(); // Update UI with initial values updateUI(); // Initialize auto-clicker info updateAutoClickerInfo(); } function createUI() { // Create egg points counter eggPointsText = new Text2("๐ฅ 0", { size: 60, fill: 0x333333 }); eggPointsText.anchor.set(0, 0); eggPointsText.x = 30; eggPointsText.y = 30; LK.gui.addChild(eggPointsText); // Create coins counter coinsText = new Text2("๐ฐ 0", { size: 60, fill: 0x333333 }); coinsText.anchor.set(1, 0); coinsText.x = 2048 - 30; coinsText.y = 30; LK.gui.addChild(coinsText); // Create skins shop button var skinsButton = LK.getAsset('shopButton', { anchorX: 0.5, anchorY: 0.5 }); skinsButton.x = 120; skinsButton.y = 2732 - 120; game.addChild(skinsButton); var skinsButtonText = new Text2("Skins", { size: 40, fill: 0xFFFFFF }); skinsButtonText.anchor.set(0.5, 0.5); skinsButtonText.x = 120; skinsButtonText.y = 2732 - 120; game.addChild(skinsButtonText); // Create auto-clicker button var autoClickerButton = LK.getAsset('autoClickerButton', { anchorX: 0.5, anchorY: 0.5 }); autoClickerButton.x = 2048 - 120; autoClickerButton.y = 2732 - 120; game.addChild(autoClickerButton); var autoClickerButtonText = new Text2("Auto", { size: 40, fill: 0xFFFFFF }); autoClickerButtonText.anchor.set(0.5, 0.5); autoClickerButtonText.x = 2048 - 120; autoClickerButtonText.y = 2732 - 120; game.addChild(autoClickerButtonText); // Add click handlers to buttons skinsButton.interactive = true; skinsButton.down = function () { skinsPanel.visible = true; autoClickerPanel.visible = false; LK.getSound('click').play(); }; autoClickerButton.interactive = true; autoClickerButton.down = function () { autoClickerPanel.visible = true; skinsPanel.visible = false; LK.getSound('click').play(); }; } function createShopPanels() { // Create skins panel skinsPanel = game.addChild(new ShopPanel("skins")); skinsPanel.x = 2048 / 2; skinsPanel.y = 2732 / 2; skinsPanel.visible = false; // Create auto-clicker panel autoClickerPanel = game.addChild(new ShopPanel("autoClicker")); autoClickerPanel.x = 2048 / 2; autoClickerPanel.y = 2732 / 2; autoClickerPanel.visible = false; } function updateUI() { // Update egg points counter eggPointsText.setText("๐ฅ " + formatNumber(storage.eggPoints)); // Update coins counter coinsText.setText("๐ฐ " + formatNumber(storage.coins)); } function updateAutoClickerInfo() { if (!autoClickerInfoText) return; var level = storage.autoClickerLevel; var pointsRate = getAutoClickerPointsRate(); var coinsRate = getAutoClickerCoinsRate(); var infoString = "Level " + level + "/20\n"; infoString += "+" + formatNumber(pointsRate) + " pts/sec"; if (level >= 10) { infoString += " | +" + formatNumber(coinsRate) + " coins/sec"; } autoClickerInfoText.setText(infoString); } function addEggPoints(amount) { storage.eggPoints += amount; updateUI(); } function createFloatingPoints(value, x, y) { var floatingPoints = game.addChild(new FloatingPoints(value, x, y)); } function getPointsPerClick(skin) { switch (skin) { case "basic": return 1; case "golden": return 5; case "spotted": return 25; case "striped": return 100; case "crystal": return 500; case "galaxy": return 2500; case "rainbow": return 100000; default: return 1; } } function getAutoClickerPointsRate() { var level = storage.autoClickerLevel; if (level === 0) return 0; return (0.05 * Math.pow(1.2, level - 1)).toFixed(2); } function getAutoClickerCoinsRate() { var level = storage.autoClickerLevel; if (level < 10) return 0; return (0.005 * Math.pow(1.2, level - 10)).toFixed(3); } function getAutoClickerUpgradeCost() { var level = storage.autoClickerLevel; return Math.floor(5 * Math.pow(2, level)); } function formatNumber(num) { if (num >= 1000000) { return (num / 1000000).toFixed(1) + "M"; } else if (num >= 1000) { return (num / 1000).toFixed(1) + "K"; } return Math.floor(num); } // Game update loop game.update = function () { var currentTime = Date.now(); // Handle auto-clicker if (storage.autoClickerLevel > 0) { // Calculate points to add based on time passed var pointsRate = getAutoClickerPointsRate(); var timeSinceLastAutoClick = (currentTime - lastAutoClickTime) / 1000; // in seconds var pointsToAdd = pointsRate * timeSinceLastAutoClick; if (pointsToAdd >= 0.1) { // Only update if at least 0.1 points to add storage.eggPoints += pointsToAdd; lastAutoClickTime = currentTime; updateUI(); } // Handle coin generation (level 10+) if (storage.autoClickerLevel >= 10) { var coinsRate = getAutoClickerCoinsRate(); var timeSinceLastCoinGeneration = (currentTime - lastCoinGenerationTime) / 1000; // in seconds var coinsToAdd = coinsRate * timeSinceLastCoinGeneration; if (coinsToAdd >= 0.01) { // Only update if at least 0.01 coins to add storage.coins += coinsToAdd; lastCoinGenerationTime = currentTime; updateUI(); } } } };
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,519 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1", {
+ eggPoints: 0,
+ coins: 0,
+ currentSkin: "basic",
+ autoClickerLevel: 0
+});
+
+/****
+* Classes
+****/
+var Egg = Container.expand(function () {
+ var self = Container.call(this);
+ // Properties
+ self.skin = storage.currentSkin || 'basic';
+ self.pointsPerClick = getPointsPerClick(self.skin);
+ // Create egg graphic based on current skin
+ var eggGraphic = self.attachAsset(self.skin + 'Egg', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1,
+ scaleY: 1
+ });
+ // Animation state
+ self.isAnimating = false;
+ // Click handler
+ self.down = function (x, y, obj) {
+ if (!self.isAnimating) {
+ self.isAnimating = true;
+ // Play tap sound
+ LK.getSound('eggTap').play();
+ // Animate egg on tap
+ tween(eggGraphic, {
+ scaleX: 0.9,
+ scaleY: 0.9
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ tween(eggGraphic, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 100,
+ onFinish: function onFinish() {
+ self.isAnimating = false;
+ }
+ });
+ }
+ });
+ // Add points
+ addEggPoints(self.pointsPerClick);
+ // Create floating number effect
+ createFloatingPoints(self.pointsPerClick, x, y);
+ }
+ };
+ // Change skin method
+ self.changeSkin = function (newSkin) {
+ // Remove old graphic
+ eggGraphic.destroy();
+ // Update skin and points
+ self.skin = newSkin;
+ self.pointsPerClick = getPointsPerClick(newSkin);
+ // Create new graphic with updated skin
+ eggGraphic = self.attachAsset(newSkin + 'Egg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Save current skin to storage
+ storage.currentSkin = newSkin;
+ // Flash to indicate upgrade
+ LK.effects.flashObject(eggGraphic, 0xFFFFFF, 500);
+ };
+ return self;
+});
+var FloatingPoints = Container.expand(function (value, startX, startY) {
+ var self = Container.call(this);
+ // Position the container
+ self.x = startX;
+ self.y = startY;
+ // Create text
+ var text = self.addChild(new Text2("+" + value, {
+ size: 40,
+ fill: 0xFFCC00
+ }));
+ text.anchor.set(0.5, 0.5);
+ // Animate the floating points
+ tween(self, {
+ y: self.y - 100,
+ alpha: 0
+ }, {
+ duration: 1000,
+ onFinish: function onFinish() {
+ self.destroy();
+ }
+ });
+ return self;
+});
+var ShopItem = Container.expand(function (itemType, itemName, cost, description) {
+ var self = Container.call(this);
+ // Properties
+ self.itemType = itemType; // "skin" or "autoClicker"
+ self.itemName = itemName;
+ self.cost = cost;
+ self.description = description;
+ self.purchased = false;
+ // Create background
+ var background = self.attachAsset('shopItemBg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Create icon
+ var icon;
+ if (itemType === "skin") {
+ icon = self.attachAsset(itemName + 'Egg', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -150,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ } else {
+ icon = self.attachAsset('autoClicker', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -150,
+ scaleX: 0.6,
+ scaleY: 0.6
+ });
+ }
+ // Create item name text
+ var nameText = self.addChild(new Text2(itemName, {
+ size: 40,
+ fill: 0x000000
+ }));
+ nameText.anchor.set(0, 0.5);
+ nameText.x = -70;
+ nameText.y = -30;
+ // Create description text
+ var descText = self.addChild(new Text2(description, {
+ size: 30,
+ fill: 0x444444
+ }));
+ descText.anchor.set(0, 0.5);
+ descText.x = -70;
+ descText.y = 10;
+ // Create cost text
+ var costText = self.addChild(new Text2((itemType === "skin" ? "๐ฅ " : "๐ฐ ") + cost, {
+ size: 35,
+ fill: 0x000000
+ }));
+ costText.anchor.set(1, 0.5);
+ costText.x = 170;
+ costText.y = 0;
+ // Click handler
+ self.down = function () {
+ if (self.itemType === "skin") {
+ if (storage.eggPoints >= self.cost && storage.currentSkin !== self.itemName) {
+ // Purchase skin
+ storage.eggPoints -= self.cost;
+ egg.changeSkin(self.itemName);
+ LK.getSound('purchase').play();
+ updateUI();
+ } else if (storage.currentSkin === self.itemName) {
+ // Already equipped
+ LK.getSound('error').play();
+ } else {
+ // Not enough points
+ LK.getSound('error').play();
+ LK.effects.flashObject(costText, 0xFF0000, 300);
+ }
+ } else if (self.itemType === "autoClicker") {
+ if (storage.coins >= self.cost && storage.autoClickerLevel < 20) {
+ // Purchase auto-clicker upgrade
+ storage.coins -= self.cost;
+ storage.autoClickerLevel++;
+ LK.getSound('purchase').play();
+ updateAutoClickerInfo();
+ updateUI();
+ } else if (storage.autoClickerLevel >= 20) {
+ // Max level reached
+ LK.getSound('error').play();
+ } else {
+ // Not enough coins
+ LK.getSound('error').play();
+ LK.effects.flashObject(costText, 0xFF0000, 300);
+ }
+ }
+ };
+ return self;
+});
+var ShopPanel = Container.expand(function (panelType) {
+ var self = Container.call(this);
+ // Properties
+ self.panelType = panelType; // "skins" or "autoClicker"
+ // Create background
+ var background = self.attachAsset('shopPanelBg', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Create title
+ var title = self.addChild(new Text2(panelType === "skins" ? "Egg Skins" : "Auto-Clicker", {
+ size: 60,
+ fill: 0x000000
+ }));
+ title.anchor.set(0.5, 0);
+ title.y = -320;
+ // Create items container
+ var itemsContainer = self.addChild(new Container());
+ itemsContainer.y = -220;
+ // Add shop items based on panel type
+ if (panelType === "skins") {
+ // Add skin items
+ var skins = [{
+ name: "basic",
+ cost: 0,
+ desc: "Standard egg (1 pt/click)"
+ }, {
+ name: "golden",
+ cost: 100,
+ desc: "Fancy gold egg (5 pts/click)"
+ }, {
+ name: "spotted",
+ cost: 500,
+ desc: "Spotted egg (25 pts/click)"
+ }, {
+ name: "striped",
+ cost: 2500,
+ desc: "Striped egg (100 pts/click)"
+ }, {
+ name: "crystal",
+ cost: 10000,
+ desc: "Crystal egg (500 pts/click)"
+ }, {
+ name: "galaxy",
+ cost: 50000,
+ desc: "Cosmic egg (2,500 pts/click)"
+ }, {
+ name: "rainbow",
+ cost: 1000000,
+ desc: "Ultimate egg (100,000 pts/click)"
+ }];
+ for (var i = 0; i < skins.length; i++) {
+ var skin = skins[i];
+ var item = itemsContainer.addChild(new ShopItem("skin", skin.name, skin.cost, skin.desc));
+ item.y = i * 100;
+ }
+ } else {
+ // Add auto-clicker info
+ var infoBox = itemsContainer.attachAsset('infoBg', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: -50
+ });
+ autoClickerInfoText = itemsContainer.addChild(new Text2("", {
+ size: 35,
+ fill: 0x000000
+ }));
+ autoClickerInfoText.anchor.set(0.5, 0.5);
+ autoClickerInfoText.y = -50;
+ // Create upgrade button
+ var upgradeItem = itemsContainer.addChild(new ShopItem("autoClicker", "Upgrade Auto-Clicker", getAutoClickerUpgradeCost(), "Level up your automatic egg tapper"));
+ upgradeItem.y = 70;
+ // Create convert button
+ var convertButton = itemsContainer.attachAsset('convertButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: 170
+ });
+ var convertText = itemsContainer.addChild(new Text2("Convert 1000 Points to 1 Coin", {
+ size: 35,
+ fill: 0xFFFFFF
+ }));
+ convertText.anchor.set(0.5, 0.5);
+ convertText.y = 170;
+ // Add convert button functionality
+ convertButton.interactive = true;
+ convertButton.down = function () {
+ if (storage.eggPoints >= 1000) {
+ storage.eggPoints -= 1000;
+ storage.coins++;
+ LK.getSound('convert').play();
+ updateUI();
+ } else {
+ LK.getSound('error').play();
+ LK.effects.flashObject(convertText, 0xFF0000, 300);
+ }
+ };
+ }
+ // Create close button
+ var closeButton = self.attachAsset('closeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 300,
+ y: -320
+ });
+ closeButton.down = function () {
+ self.visible = false;
+ LK.getSound('click').play();
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0xF5F5F5
+});
+
+/****
+* Game Code
+****/
+// Play background music
+// Assets will be initialized automatically based on usage
+// Initialize assets required for the game
+// Initialize sounds
+// Initialize music
+LK.playMusic('bgMusic');
+// Game variables
+var lastAutoClickTime = Date.now();
+var lastCoinGenerationTime = Date.now();
+var egg;
+var eggPointsText;
+var coinsText;
+var skinsPanel;
+var autoClickerPanel;
+var autoClickerInfoText;
+// Initialize game elements
+initGame();
+function initGame() {
+ // Create egg
+ egg = game.addChild(new Egg());
+ egg.x = 2048 / 2;
+ egg.y = 2732 / 2;
+ // Create UI elements
+ createUI();
+ // Create shop panels
+ createShopPanels();
+ // Update UI with initial values
+ updateUI();
+ // Initialize auto-clicker info
+ updateAutoClickerInfo();
+}
+function createUI() {
+ // Create egg points counter
+ eggPointsText = new Text2("๐ฅ 0", {
+ size: 60,
+ fill: 0x333333
+ });
+ eggPointsText.anchor.set(0, 0);
+ eggPointsText.x = 30;
+ eggPointsText.y = 30;
+ LK.gui.addChild(eggPointsText);
+ // Create coins counter
+ coinsText = new Text2("๐ฐ 0", {
+ size: 60,
+ fill: 0x333333
+ });
+ coinsText.anchor.set(1, 0);
+ coinsText.x = 2048 - 30;
+ coinsText.y = 30;
+ LK.gui.addChild(coinsText);
+ // Create skins shop button
+ var skinsButton = LK.getAsset('shopButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ skinsButton.x = 120;
+ skinsButton.y = 2732 - 120;
+ game.addChild(skinsButton);
+ var skinsButtonText = new Text2("Skins", {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ skinsButtonText.anchor.set(0.5, 0.5);
+ skinsButtonText.x = 120;
+ skinsButtonText.y = 2732 - 120;
+ game.addChild(skinsButtonText);
+ // Create auto-clicker button
+ var autoClickerButton = LK.getAsset('autoClickerButton', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ autoClickerButton.x = 2048 - 120;
+ autoClickerButton.y = 2732 - 120;
+ game.addChild(autoClickerButton);
+ var autoClickerButtonText = new Text2("Auto", {
+ size: 40,
+ fill: 0xFFFFFF
+ });
+ autoClickerButtonText.anchor.set(0.5, 0.5);
+ autoClickerButtonText.x = 2048 - 120;
+ autoClickerButtonText.y = 2732 - 120;
+ game.addChild(autoClickerButtonText);
+ // Add click handlers to buttons
+ skinsButton.interactive = true;
+ skinsButton.down = function () {
+ skinsPanel.visible = true;
+ autoClickerPanel.visible = false;
+ LK.getSound('click').play();
+ };
+ autoClickerButton.interactive = true;
+ autoClickerButton.down = function () {
+ autoClickerPanel.visible = true;
+ skinsPanel.visible = false;
+ LK.getSound('click').play();
+ };
+}
+function createShopPanels() {
+ // Create skins panel
+ skinsPanel = game.addChild(new ShopPanel("skins"));
+ skinsPanel.x = 2048 / 2;
+ skinsPanel.y = 2732 / 2;
+ skinsPanel.visible = false;
+ // Create auto-clicker panel
+ autoClickerPanel = game.addChild(new ShopPanel("autoClicker"));
+ autoClickerPanel.x = 2048 / 2;
+ autoClickerPanel.y = 2732 / 2;
+ autoClickerPanel.visible = false;
+}
+function updateUI() {
+ // Update egg points counter
+ eggPointsText.setText("๐ฅ " + formatNumber(storage.eggPoints));
+ // Update coins counter
+ coinsText.setText("๐ฐ " + formatNumber(storage.coins));
+}
+function updateAutoClickerInfo() {
+ if (!autoClickerInfoText) return;
+ var level = storage.autoClickerLevel;
+ var pointsRate = getAutoClickerPointsRate();
+ var coinsRate = getAutoClickerCoinsRate();
+ var infoString = "Level " + level + "/20\n";
+ infoString += "+" + formatNumber(pointsRate) + " pts/sec";
+ if (level >= 10) {
+ infoString += " | +" + formatNumber(coinsRate) + " coins/sec";
+ }
+ autoClickerInfoText.setText(infoString);
+}
+function addEggPoints(amount) {
+ storage.eggPoints += amount;
+ updateUI();
+}
+function createFloatingPoints(value, x, y) {
+ var floatingPoints = game.addChild(new FloatingPoints(value, x, y));
+}
+function getPointsPerClick(skin) {
+ switch (skin) {
+ case "basic":
+ return 1;
+ case "golden":
+ return 5;
+ case "spotted":
+ return 25;
+ case "striped":
+ return 100;
+ case "crystal":
+ return 500;
+ case "galaxy":
+ return 2500;
+ case "rainbow":
+ return 100000;
+ default:
+ return 1;
+ }
+}
+function getAutoClickerPointsRate() {
+ var level = storage.autoClickerLevel;
+ if (level === 0) return 0;
+ return (0.05 * Math.pow(1.2, level - 1)).toFixed(2);
+}
+function getAutoClickerCoinsRate() {
+ var level = storage.autoClickerLevel;
+ if (level < 10) return 0;
+ return (0.005 * Math.pow(1.2, level - 10)).toFixed(3);
+}
+function getAutoClickerUpgradeCost() {
+ var level = storage.autoClickerLevel;
+ return Math.floor(5 * Math.pow(2, level));
+}
+function formatNumber(num) {
+ if (num >= 1000000) {
+ return (num / 1000000).toFixed(1) + "M";
+ } else if (num >= 1000) {
+ return (num / 1000).toFixed(1) + "K";
+ }
+ return Math.floor(num);
+}
+// Game update loop
+game.update = function () {
+ var currentTime = Date.now();
+ // Handle auto-clicker
+ if (storage.autoClickerLevel > 0) {
+ // Calculate points to add based on time passed
+ var pointsRate = getAutoClickerPointsRate();
+ var timeSinceLastAutoClick = (currentTime - lastAutoClickTime) / 1000; // in seconds
+ var pointsToAdd = pointsRate * timeSinceLastAutoClick;
+ if (pointsToAdd >= 0.1) {
+ // Only update if at least 0.1 points to add
+ storage.eggPoints += pointsToAdd;
+ lastAutoClickTime = currentTime;
+ updateUI();
+ }
+ // Handle coin generation (level 10+)
+ if (storage.autoClickerLevel >= 10) {
+ var coinsRate = getAutoClickerCoinsRate();
+ var timeSinceLastCoinGeneration = (currentTime - lastCoinGenerationTime) / 1000; // in seconds
+ var coinsToAdd = coinsRate * timeSinceLastCoinGeneration;
+ if (coinsToAdd >= 0.01) {
+ // Only update if at least 0.01 coins to add
+ storage.coins += coinsToAdd;
+ lastCoinGenerationTime = currentTime;
+ updateUI();
+ }
+ }
+ }
+};
\ No newline at end of file
A Pixelated Egg. In-Game asset. 2d. High contrast. No shadows
A Diamond egg. In-Game asset. 2d. High contrast. No shadows
A Rainbow egg. In-Game asset. 2d. High contrast. No shadows
A regular Egg. In-Game asset. 2d. High contrast. No shadows
A Crystal-like egg. In-Game asset. 2d. High contrast. No shadows
A yellow egg With Blue dots. In-Game asset. 2d. High contrast. No shadows
A Galactic Egg. In-Game asset. 2d. High contrast. No shadows
A Golden egg. In-Game asset. 2d. High contrast. No shadows
A Cyan egg with Blue Stripes. In-Game asset. 2d. High contrast. No shadows
A Obsidian egg. In-Game asset. 2d. High contrast. No shadows
A glitched, Error egg. In-Game asset. 2d. High contrast. No shadows