User prompt
When you restart and you had egg points, The old amount (The one you had before the reset) Overlaps the New amount (The one after the reset) Could you fix that?
User prompt
Make Wide egg use "wideegg" Asset
User prompt
Remove Money Overlapping when Using code "RESET"
User prompt
Add "WIDE" code back But make it Award Wideegg Or wide Egg
User prompt
Remove Square egg
User prompt
Change code "SQUARE" to Code "WIDE" which Awards wideegg or Wide egg
User prompt
Add in a Code called "SQUARE" that Gives you The Square egg
User prompt
Make it so Using Code "RESET" Restarts EVERYTHING including Money, It simply restarts EVERYTHING in game ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Make it So Typing "RESET" in the codes Restarts your game from The start, Including codes
User prompt
Please fix the bug: 'self.switchTab is not a function' in or related to this line: 'self.switchTab("regular");' Line Number: 582
User prompt
Please fix the bug: 'self.switchTab is not a function' in or related to this line: 'self.switchTab("regular");' Line Number: 582
User prompt
Fix Compilation error[L582]: self.switchTab is not a function By adding The self.switchTab function and Creating it
User prompt
Please fix the bug: "Compilation error[L582]: self.switchTab is not a function"
User prompt
Please fix the bug: 'self.switchTab is not a function' in or related to this line: 'self.switchTab("regular");' Line Number: 582
User prompt
Please fix the bug: 'self.switchTab is not a function' in or related to this line: 'self.switchTab("regular");' Line Number: 582
User prompt
Add a Seperate Tab In the Skins Section For code Eggs to avoid clutter
User prompt
Fix Compilation error[L96]: Cannot read properties of undefined (reading 'attachAsset')
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var inputBg = codeContainer.attachAsset('codeInputBg', {' Line Number: 96
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'attachAsset')' in or related to this line: 'var inputBg = codeContainer.attachAsset('codeInputBg', {' Line Number: 96
User prompt
Add a Separate Tab For Code eggs And Add a Button that Resets all Your progress ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Add a Code called "PIXEL" which Unlocks PIXEL EGG
User prompt
Try again
User prompt
Add code "CODE1[NOTFOUND]" which rewards The Special ERROR egg skin
User prompt
i think you replaced the P and T with "Clear" And "Delete" Since i see It nowhere, revamp the Pre-made Keyboard and Put clear and Delete buttons at the bottom
User prompt
Try again
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1", {
eggPoints: 0,
coins: 0,
currentSkin: "basic",
autoClickerLevel: 0,
unlockedSkins: {},
enteredCodes: {}
});
/****
* Classes
****/
var CodeInputPanel = Container.expand(function () {
var self = Container.call(this);
// Create background
var background = self.attachAsset('shopPanelBg', {
anchorX: 0.5,
anchorY: 0.5
});
// Create title
var title = self.addChild(new Text2("Enter Code", {
size: 60,
fill: 0x000000
}));
title.anchor.set(0.5, 0);
title.y = -320;
// Create input background
var inputBg = self.attachAsset('codeInputBg', {
anchorX: 0.5,
anchorY: 0.5,
y: -100
});
// Create input text display
var inputText = self.addChild(new Text2("", {
size: 40,
fill: 0x000000
}));
inputText.anchor.set(0.5, 0.5);
inputText.y = -100;
// Create submit button
var submitButton = self.attachAsset('convertButton', {
anchorX: 0.5,
anchorY: 0.5,
y: 50
});
var submitText = self.addChild(new Text2("Submit", {
size: 40,
fill: 0xFFFFFF
}));
submitText.anchor.set(0.5, 0.5);
submitText.y = 50;
// Create result text
var resultText = self.addChild(new Text2("", {
size: 30,
fill: 0x000000
}));
resultText.anchor.set(0.5, 0.5);
resultText.y = 150;
// Create close button
var closeButton = self.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: -320
});
// Input handling
self.currentInput = "";
// Virtual keyboard buttons
var keyboard = self.addChild(new Container());
keyboard.y = 220;
// Custom key arrangement with all letters and numbers
var keys = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "]", "<", ">"];
var keySize = 60;
var keysPerRow = 10;
for (var i = 0; i < keys.length; i++) {
var keyX = (i % keysPerRow - keysPerRow / 2 + 0.5) * (keySize + 5);
var keyY = Math.floor(i / keysPerRow) * (keySize + 10);
var keyBg = keyboard.attachAsset('shopItemBg', {
anchorX: 0.5,
anchorY: 0.5,
x: keyX,
y: keyY,
width: keySize,
height: keySize
});
var keyText = keyboard.addChild(new Text2(keys[i], {
size: 30,
fill: 0x000000
}));
keyText.anchor.set(0.5, 0.5);
keyText.x = keyX;
keyText.y = keyY;
// Make key interactive
keyBg.interactive = true;
keyBg.keyValue = keys[i];
keyBg.down = function () {
if (self.currentInput.length < 15) {
self.currentInput += this.keyValue;
inputText.setText(self.currentInput);
LK.getSound('click').play();
}
};
}
// Control buttons at the bottom
var controlY = Math.ceil(keys.length / keysPerRow) * (keySize + 10) + 30;
// Clear button
var clearBg = keyboard.attachAsset('shopItemBg', {
anchorX: 0.5,
anchorY: 0.5,
x: -140,
y: controlY,
width: 120,
height: 60
});
var clearText = keyboard.addChild(new Text2("Clear", {
size: 30,
fill: 0x000000
}));
clearText.anchor.set(0.5, 0.5);
clearText.x = -140;
clearText.y = controlY;
clearBg.interactive = true;
clearBg.down = function () {
self.currentInput = "";
inputText.setText("");
LK.getSound('click').play();
};
// Backspace button
var backspaceBg = keyboard.attachAsset('shopItemBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 140,
y: controlY,
width: 120,
height: 60
});
var backspaceText = keyboard.addChild(new Text2("Delete", {
size: 30,
fill: 0x000000
}));
backspaceText.anchor.set(0.5, 0.5);
backspaceText.x = 140;
backspaceText.y = controlY;
backspaceBg.interactive = true;
backspaceBg.down = function () {
if (self.currentInput.length > 0) {
self.currentInput = self.currentInput.slice(0, -1);
inputText.setText(self.currentInput);
LK.getSound('click').play();
}
};
// Submit button handler
submitButton.interactive = true;
submitButton.down = function () {
LK.getSound('click').play();
self.checkCode(self.currentInput);
};
// Close button handler
closeButton.interactive = true;
closeButton.down = function () {
self.visible = false;
LK.getSound('click').play();
};
// Code checking
self.checkCode = function (code) {
// Check if code has already been used
if (storage.enteredCodes[code]) {
resultText.setText("Code already used!");
LK.getSound('error').play();
return;
}
// Check valid codes
if (code === "CODE1[NOTFOUND]" || code === "code1[notfound]") {
// Special ERROR egg skin
unlockSpecialSkin("error");
resultText.setText("ERROR egg unlocked!");
storage.enteredCodes[code] = true;
LK.getSound('purchase').play();
} else if (code === "DIAMOND123") {
unlockSpecialSkin("diamond");
resultText.setText("Diamond egg unlocked!");
storage.enteredCodes[code] = true;
LK.getSound('purchase').play();
} else if (code === "PIXEL8BIT" || code === "PIXEL") {
unlockSpecialSkin("pixel");
resultText.setText("Pixel egg unlocked!");
storage.enteredCodes[code] = true;
LK.getSound('purchase').play();
} else if (code === "OBSIDIAN") {
unlockSpecialSkin("obsidian");
resultText.setText("Obsidian egg unlocked!");
storage.enteredCodes[code] = true;
LK.getSound('purchase').play();
} else if (code === "FREECOINS") {
storage.coins += 100;
resultText.setText("100 coins added!");
storage.enteredCodes[code] = true;
LK.getSound('purchase').play();
updateUI();
} else if (code === "BOOST") {
storage.eggPoints += 10000;
resultText.setText("10,000 egg points added!");
storage.enteredCodes[code] = true;
LK.getSound('purchase').play();
updateUI();
} else {
resultText.setText("Invalid code");
LK.getSound('error').play();
}
};
return self;
});
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"
self.currentTab = "regular"; // Default tab for skins panel
// 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;
// Create tab containers if this is the skins panel
var regularTabContainer;
var codeTabContainer;
var regularTabButton;
var codeTabButton;
if (panelType === "skins") {
// Create tab buttons
regularTabButton = self.attachAsset('shopItemBg', {
anchorX: 0.5,
anchorY: 0.5,
x: -100,
y: -250,
width: 180,
height: 60
});
var regularTabText = self.addChild(new Text2("Regular", {
size: 35,
fill: 0x000000
}));
regularTabText.anchor.set(0.5, 0.5);
regularTabText.x = -100;
regularTabText.y = -250;
codeTabButton = self.attachAsset('shopItemBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 100,
y: -250,
width: 180,
height: 60
});
var codeTabText = self.addChild(new Text2("Code Eggs", {
size: 35,
fill: 0x000000
}));
codeTabText.anchor.set(0.5, 0.5);
codeTabText.x = 100;
codeTabText.y = -250;
// Make tab buttons interactive
regularTabButton.interactive = true;
regularTabButton.down = function () {
self.switchTab("regular");
LK.getSound('click').play();
};
codeTabButton.interactive = true;
codeTabButton.down = function () {
self.switchTab("code");
LK.getSound('click').play();
};
// Create containers for each tab
regularTabContainer = itemsContainer.addChild(new Container());
codeTabContainer = itemsContainer.addChild(new Container());
// Regular skins
var regularSkins = [{
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)"
}];
// Code-unlockable skins
var codeSkins = [];
// Add special skins that can be unlocked through codes
if (storage.unlockedSkins && storage.unlockedSkins.error) {
codeSkins.push({
name: "error",
cost: 0,
desc: "ERROR egg (50,000 pts/click)"
});
}
if (storage.unlockedSkins && storage.unlockedSkins.diamond) {
codeSkins.push({
name: "diamond",
cost: 0,
desc: "Diamond egg (10,000 pts/click)"
});
}
if (storage.unlockedSkins && storage.unlockedSkins.pixel) {
codeSkins.push({
name: "pixel",
cost: 0,
desc: "Pixel egg (15,000 pts/click)"
});
}
if (storage.unlockedSkins && storage.unlockedSkins.obsidian) {
codeSkins.push({
name: "obsidian",
cost: 0,
desc: "Obsidian egg (20,000 pts/click)"
});
}
// Add regular skins to regular tab
for (var i = 0; i < regularSkins.length; i++) {
var skin = regularSkins[i];
var item = regularTabContainer.addChild(new ShopItem("skin", skin.name, skin.cost, skin.desc));
item.y = i * 100;
}
// Add code skins to code tab
if (codeSkins.length === 0) {
// Show a message if no code skins unlocked
var noSkinsText = codeTabContainer.addChild(new Text2("No code eggs unlocked yet.\nEnter codes to unlock special eggs!", {
size: 35,
fill: 0x000000
}));
noSkinsText.anchor.set(0.5, 0.5);
noSkinsText.y = 100;
} else {
for (var j = 0; j < codeSkins.length; j++) {
var codeSkin = codeSkins[j];
var codeItem = codeTabContainer.addChild(new ShopItem("skin", codeSkin.name, codeSkin.cost, codeSkin.desc));
codeItem.y = j * 100;
}
}
// Start with regular tab visible
self.switchTab("regular");
} 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);
}
};
}
// Method to switch between tabs
self.switchTab = function (tabName) {
if (panelType === "skins") {
self.currentTab = tabName;
if (tabName === "regular") {
regularTabContainer.visible = true;
codeTabContainer.visible = false;
// Highlight the active tab
regularTabButton.tint = 0x2196f3;
codeTabButton.tint = 0xFFFFFF;
} else {
regularTabContainer.visible = false;
codeTabContainer.visible = true;
// Highlight the active tab
regularTabButton.tint = 0xFFFFFF;
codeTabButton.tint = 0x2196f3;
}
}
};
// 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;
var codeInputPanel;
// Function to unlock special skins
function unlockSpecialSkin(skinName) {
if (!storage.unlockedSkins) {
storage.unlockedSkins = {
"basic": true
};
}
storage.unlockedSkins[skinName] = true;
// Refresh shop panel to show new skin
skinsPanel.destroy();
skinsPanel = game.addChild(new ShopPanel("skins"));
skinsPanel.x = 2048 / 2;
skinsPanel.y = 2732 / 2;
skinsPanel.visible = false;
// Switch to code tab to show newly unlocked skin
skinsPanel.switchTab("code");
}
// 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);
// Create code button
var codeButton = LK.getAsset('shopButton', {
anchorX: 0.5,
anchorY: 0.5
});
codeButton.x = 2048 / 2;
codeButton.y = 2732 - 120;
game.addChild(codeButton);
var codeButtonText = new Text2("Codes", {
size: 40,
fill: 0xFFFFFF
});
codeButtonText.anchor.set(0.5, 0.5);
codeButtonText.x = 2048 / 2;
codeButtonText.y = 2732 - 120;
game.addChild(codeButtonText);
// Add click handlers to buttons
skinsButton.interactive = true;
skinsButton.down = function () {
skinsPanel.visible = true;
autoClickerPanel.visible = false;
codeInputPanel.visible = false;
LK.getSound('click').play();
};
autoClickerButton.interactive = true;
autoClickerButton.down = function () {
autoClickerPanel.visible = true;
skinsPanel.visible = false;
codeInputPanel.visible = false;
LK.getSound('click').play();
};
codeButton.interactive = true;
codeButton.down = function () {
codeInputPanel.visible = true;
skinsPanel.visible = false;
autoClickerPanel.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;
// Create code input panel
codeInputPanel = game.addChild(new CodeInputPanel());
codeInputPanel.x = 2048 / 2;
codeInputPanel.y = 2732 / 2;
codeInputPanel.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;
case "error":
return 50000;
case "diamond":
return 10000;
case "pixel":
return 15000;
case "obsidian":
return 20000;
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
@@ -20,79 +20,42 @@
var background = self.attachAsset('shopPanelBg', {
anchorX: 0.5,
anchorY: 0.5
});
- // Create tabs
- self.activeTab = "code"; // code or eggs
// Create title
var title = self.addChild(new Text2("Enter Code", {
size: 60,
fill: 0x000000
}));
title.anchor.set(0.5, 0);
title.y = -320;
- // Create tab containers
- var codeContainer = self.addChild(new Container());
- var eggsContainer = self.addChild(new Container());
- eggsContainer.visible = false;
- // Create tab buttons
- var codeTabBg = self.attachAsset('shopItemBg', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: -120,
- y: -250,
- width: 180,
- height: 60
- });
- var codeTabText = self.addChild(new Text2("Codes", {
- size: 35,
- fill: 0x000000
- }));
- codeTabText.anchor.set(0.5, 0.5);
- codeTabText.x = -120;
- codeTabText.y = -250;
- var eggsTabBg = self.attachAsset('shopItemBg', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: 120,
- y: -250,
- width: 180,
- height: 60
- });
- var eggsTabText = self.addChild(new Text2("Eggs", {
- size: 35,
- fill: 0x000000
- }));
- eggsTabText.anchor.set(0.5, 0.5);
- eggsTabText.x = 120;
- eggsTabText.y = -250;
// Create input background
- var inputBg = codeContainer.attachAsset('codeInputBg', {
+ var inputBg = self.attachAsset('codeInputBg', {
anchorX: 0.5,
anchorY: 0.5,
y: -100
});
// Create input text display
- var inputText = codeContainer.addChild(new Text2("", {
+ var inputText = self.addChild(new Text2("", {
size: 40,
fill: 0x000000
}));
inputText.anchor.set(0.5, 0.5);
inputText.y = -100;
// Create submit button
- var submitButton = codeContainer.attachAsset('convertButton', {
+ var submitButton = self.attachAsset('convertButton', {
anchorX: 0.5,
anchorY: 0.5,
y: 50
});
- var submitText = codeContainer.addChild(new Text2("Submit", {
+ var submitText = self.addChild(new Text2("Submit", {
size: 40,
fill: 0xFFFFFF
}));
submitText.anchor.set(0.5, 0.5);
submitText.y = 50;
// Create result text
- var resultText = codeContainer.addChild(new Text2("", {
+ var resultText = self.addChild(new Text2("", {
size: 30,
fill: 0x000000
}));
resultText.anchor.set(0.5, 0.5);
@@ -103,9 +66,8 @@
anchorY: 0.5,
x: 300,
y: -320
});
- // Add eggs container content
// Input handling
self.currentInput = "";
// Virtual keyboard buttons
var keyboard = self.addChild(new Container());
@@ -153,201 +115,8 @@
y: controlY,
width: 120,
height: 60
});
- // Add eggs container content
- var eggsTitle = eggsContainer.addChild(new Text2("Unlocked Eggs", {
- size: 40,
- fill: 0x000000
- }));
- eggsTitle.anchor.set(0.5, 0);
- eggsTitle.y = -180;
- var eggsList = eggsContainer.addChild(new Container());
- eggsList.y = -100;
- // Reset button for eggs tab
- var resetButton = eggsContainer.attachAsset('convertButton', {
- anchorX: 0.5,
- anchorY: 0.5,
- y: 300,
- tint: 0xFF5555
- });
- var resetText = eggsContainer.addChild(new Text2("Reset All Progress", {
- size: 35,
- fill: 0xFFFFFF
- }));
- resetText.anchor.set(0.5, 0.5);
- resetText.y = 300;
- resetButton.interactive = true;
- resetButton.down = function () {
- var confirmReset = confirm("Are you sure? This will reset ALL progress including coins, points, and unlocked skins!");
- if (confirmReset) {
- // Reset all progress
- storage.eggPoints = 0;
- storage.coins = 0;
- storage.currentSkin = "basic";
- storage.autoClickerLevel = 0;
- storage.unlockedSkins = {
- "basic": true
- };
- storage.enteredCodes = {};
- // Update UI
- updateUI();
- updateAutoClickerInfo();
- // Change egg skin
- if (egg) {
- egg.changeSkin("basic");
- }
- // Refresh shop panels
- if (skinsPanel) {
- skinsPanel.destroy();
- skinsPanel = game.addChild(new ShopPanel("skins"));
- skinsPanel.x = 2048 / 2;
- skinsPanel.y = 2732 / 2;
- skinsPanel.visible = false;
- }
- // Update eggs list
- updateEggsList();
- LK.getSound('click').play();
- }
- };
- // Add tabs click handlers
- codeTabBg.interactive = true;
- codeTabBg.down = function () {
- self.switchTab("code");
- LK.getSound('click').play();
- };
- eggsTabBg.interactive = true;
- eggsTabBg.down = function () {
- self.switchTab("eggs");
- LK.getSound('click').play();
- };
- // Tab switching function
- self.switchTab = function (tabName) {
- self.activeTab = tabName;
- if (tabName === "code") {
- title.setText("Enter Code");
- codeContainer.visible = true;
- eggsContainer.visible = false;
- codeTabBg.tint = 0xAAAAAA;
- eggsTabBg.tint = 0xFFFFFF;
- } else {
- title.setText("Egg Collection");
- codeContainer.visible = false;
- eggsContainer.visible = true;
- codeTabBg.tint = 0xFFFFFF;
- eggsTabBg.tint = 0xAAAAAA;
- updateEggsList();
- }
- };
- // Function to update eggs list
- function updateEggsList() {
- // Clear existing children
- while (eggsList.children.length > 0) {
- eggsList.children[0].destroy();
- }
- var eggTypes = [{
- name: "basic",
- title: "Basic Egg",
- desc: "Standard egg (1 pt/click)"
- }, {
- name: "golden",
- title: "Golden Egg",
- desc: "Fancy gold egg (5 pts/click)"
- }, {
- name: "spotted",
- title: "Spotted Egg",
- desc: "Spotted egg (25 pts/click)"
- }, {
- name: "striped",
- title: "Striped Egg",
- desc: "Striped egg (100 pts/click)"
- }, {
- name: "crystal",
- title: "Crystal Egg",
- desc: "Crystal egg (500 pts/click)"
- }, {
- name: "galaxy",
- title: "Galaxy Egg",
- desc: "Cosmic egg (2,500 pts/click)"
- }, {
- name: "rainbow",
- title: "Rainbow Egg",
- desc: "Ultimate egg (100,000 pts/click)"
- }, {
- name: "error",
- title: "ERROR Egg",
- desc: "ERROR egg (50,000 pts/click)"
- }, {
- name: "diamond",
- title: "Diamond Egg",
- desc: "Diamond egg (10,000 pts/click)"
- }, {
- name: "pixel",
- title: "Pixel Egg",
- desc: "Pixel egg (15,000 pts/click)"
- }, {
- name: "obsidian",
- title: "Obsidian Egg",
- desc: "Obsidian egg (20,000 pts/click)"
- }];
- var row = 0;
- var col = 0;
- var itemsPerRow = 2;
- var itemSize = {
- width: 250,
- height: 150
- };
- var padding = {
- x: 30,
- y: 20
- };
- for (var i = 0; i < eggTypes.length; i++) {
- var egg = eggTypes[i];
- var isUnlocked = egg.name === "basic" || storage.unlockedSkins && storage.unlockedSkins[egg.name];
- if (isUnlocked) {
- var eggItem = eggsList.addChild(new Container());
- var x = (col - 0.5) * (itemSize.width + padding.x);
- var y = row * (itemSize.height + padding.y);
- eggItem.x = x;
- eggItem.y = y;
- var itemBg = eggItem.attachAsset('shopItemBg', {
- anchorX: 0.5,
- anchorY: 0.5,
- width: itemSize.width,
- height: itemSize.height
- });
- var eggIcon = eggItem.attachAsset(egg.name + 'Egg', {
- anchorX: 0.5,
- anchorY: 0.5,
- x: -80,
- scaleX: 0.3,
- scaleY: 0.3
- });
- var eggTitle = eggItem.addChild(new Text2(egg.title, {
- size: 22,
- fill: 0x000000
- }));
- eggTitle.anchor.set(0, 0);
- eggTitle.x = -20;
- eggTitle.y = -40;
- var eggDesc = eggItem.addChild(new Text2(egg.desc, {
- size: 18,
- fill: 0x444444
- }));
- eggDesc.anchor.set(0, 0);
- eggDesc.x = -20;
- eggDesc.y = 0;
- // Update row/col position
- col++;
- if (col >= itemsPerRow) {
- col = 0;
- row++;
- }
- }
- }
- }
- // Put all code-related elements in codeContainer
- codeContainer.addChild(keyboard);
var clearText = keyboard.addChild(new Text2("Clear", {
size: 30,
fill: 0x000000
}));
@@ -627,8 +396,9 @@
var ShopPanel = Container.expand(function (panelType) {
var self = Container.call(this);
// Properties
self.panelType = panelType; // "skins" or "autoClicker"
+ self.currentTab = "regular"; // Default tab for skins panel
// Create background
var background = self.attachAsset('shopPanelBg', {
anchorX: 0.5,
anchorY: 0.5
@@ -642,12 +412,61 @@
title.y = -320;
// Create items container
var itemsContainer = self.addChild(new Container());
itemsContainer.y = -220;
- // Add shop items based on panel type
+ // Create tab containers if this is the skins panel
+ var regularTabContainer;
+ var codeTabContainer;
+ var regularTabButton;
+ var codeTabButton;
if (panelType === "skins") {
- // Add skin items
- var skins = [{
+ // Create tab buttons
+ regularTabButton = self.attachAsset('shopItemBg', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -100,
+ y: -250,
+ width: 180,
+ height: 60
+ });
+ var regularTabText = self.addChild(new Text2("Regular", {
+ size: 35,
+ fill: 0x000000
+ }));
+ regularTabText.anchor.set(0.5, 0.5);
+ regularTabText.x = -100;
+ regularTabText.y = -250;
+ codeTabButton = self.attachAsset('shopItemBg', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 100,
+ y: -250,
+ width: 180,
+ height: 60
+ });
+ var codeTabText = self.addChild(new Text2("Code Eggs", {
+ size: 35,
+ fill: 0x000000
+ }));
+ codeTabText.anchor.set(0.5, 0.5);
+ codeTabText.x = 100;
+ codeTabText.y = -250;
+ // Make tab buttons interactive
+ regularTabButton.interactive = true;
+ regularTabButton.down = function () {
+ self.switchTab("regular");
+ LK.getSound('click').play();
+ };
+ codeTabButton.interactive = true;
+ codeTabButton.down = function () {
+ self.switchTab("code");
+ LK.getSound('click').play();
+ };
+ // Create containers for each tab
+ regularTabContainer = itemsContainer.addChild(new Container());
+ codeTabContainer = itemsContainer.addChild(new Container());
+ // Regular skins
+ var regularSkins = [{
name: "basic",
cost: 0,
desc: "Standard egg (1 pt/click)"
}, {
@@ -674,42 +493,63 @@
name: "rainbow",
cost: 1000000,
desc: "Ultimate egg (100,000 pts/click)"
}];
+ // Code-unlockable skins
+ var codeSkins = [];
// Add special skins that can be unlocked through codes
if (storage.unlockedSkins && storage.unlockedSkins.error) {
- skins.push({
+ codeSkins.push({
name: "error",
cost: 0,
desc: "ERROR egg (50,000 pts/click)"
});
}
if (storage.unlockedSkins && storage.unlockedSkins.diamond) {
- skins.push({
+ codeSkins.push({
name: "diamond",
cost: 0,
desc: "Diamond egg (10,000 pts/click)"
});
}
if (storage.unlockedSkins && storage.unlockedSkins.pixel) {
- skins.push({
+ codeSkins.push({
name: "pixel",
cost: 0,
desc: "Pixel egg (15,000 pts/click)"
});
}
if (storage.unlockedSkins && storage.unlockedSkins.obsidian) {
- skins.push({
+ codeSkins.push({
name: "obsidian",
cost: 0,
desc: "Obsidian egg (20,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));
+ // Add regular skins to regular tab
+ for (var i = 0; i < regularSkins.length; i++) {
+ var skin = regularSkins[i];
+ var item = regularTabContainer.addChild(new ShopItem("skin", skin.name, skin.cost, skin.desc));
item.y = i * 100;
}
+ // Add code skins to code tab
+ if (codeSkins.length === 0) {
+ // Show a message if no code skins unlocked
+ var noSkinsText = codeTabContainer.addChild(new Text2("No code eggs unlocked yet.\nEnter codes to unlock special eggs!", {
+ size: 35,
+ fill: 0x000000
+ }));
+ noSkinsText.anchor.set(0.5, 0.5);
+ noSkinsText.y = 100;
+ } else {
+ for (var j = 0; j < codeSkins.length; j++) {
+ var codeSkin = codeSkins[j];
+ var codeItem = codeTabContainer.addChild(new ShopItem("skin", codeSkin.name, codeSkin.cost, codeSkin.desc));
+ codeItem.y = j * 100;
+ }
+ }
+ // Start with regular tab visible
+ self.switchTab("regular");
} else {
// Add auto-clicker info
var infoBox = itemsContainer.attachAsset('infoBg', {
anchorX: 0.5,
@@ -750,8 +590,27 @@
LK.effects.flashObject(convertText, 0xFF0000, 300);
}
};
}
+ // Method to switch between tabs
+ self.switchTab = function (tabName) {
+ if (panelType === "skins") {
+ self.currentTab = tabName;
+ if (tabName === "regular") {
+ regularTabContainer.visible = true;
+ codeTabContainer.visible = false;
+ // Highlight the active tab
+ regularTabButton.tint = 0x2196f3;
+ codeTabButton.tint = 0xFFFFFF;
+ } else {
+ regularTabContainer.visible = false;
+ codeTabContainer.visible = true;
+ // Highlight the active tab
+ regularTabButton.tint = 0xFFFFFF;
+ codeTabButton.tint = 0x2196f3;
+ }
+ }
+ };
// Create close button
var closeButton = self.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5,
@@ -774,13 +633,13 @@
/****
* Game Code
****/
-// Initialize music
-// Initialize sounds
-// Initialize assets required for the game
-// Assets will be initialized automatically based on usage
// 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();
@@ -804,8 +663,10 @@
skinsPanel = game.addChild(new ShopPanel("skins"));
skinsPanel.x = 2048 / 2;
skinsPanel.y = 2732 / 2;
skinsPanel.visible = false;
+ // Switch to code tab to show newly unlocked skin
+ skinsPanel.switchTab("code");
}
// Initialize game elements
initGame();
function initGame() {
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