User prompt
Okay show the number of cookies at top middle of screen with cookies per second the black box at shop is weird make it a shopping cart pixel art cookie in middle has to be bigger add sound effects to match the game make the prestige menu so u can open it and show requirements and in menu insted of saying number of upgrades it says prestige and when clicked opens the menue in the shop make everything bigger and in rows so I can see each upgrade and add 20 more custom upgrades that work the same as the others just more expensive for prestige ensure it shows you need for level 1 100k cookies and 100 upgrades when you open the menu add a main menu before you can play with a button that is a play button with 3 buttons one play button a leaderbord and settings also add a mute function in settings add a tutorial at start also make sure random cookies fall from sky and when clicked give random number of cookies based of your cookie count βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
I want everything to have custom pixel Textures also I want custom menu custom ui and a custom hud I want the ability to open a menu to show all the upgrades and the ability to scroll down to see all the upgrades I will also want it to have cookie in center of the screen and it is big prestige should be at the bottom of screen and when u click it it opens a menu showing requirements I will also want it to make it so u need a certain number of upgrades like 100 upgrades first level and up 10 every prestige βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
Prestige System* - Name: Ascension - Description: Reset your progress, but gain a permanent bonus to cookie production - Cost: 100,000 cookies - Effect: +10% cookie production bonus (cumulative) - Max Prestiges: 100 - Prestige Bonus Formula: Prestige Bonus = (Number of Prestiges x 10)% *Textures* - Cookie: A round, golden-brown cookie with a slight sheen - Cursor: A simple, hand-drawn image of a pointing finger - Grandma: A warm, watercolor-style illustration of a grandma in a baking apron - Farm: A simple, cartoon-style image of a farm with rolling hills and a few trees - Cookie Mine: A stylized, industrial-style image of a mine shaft with a cookie-shaped entrance - Cookie Factory: A modern, sleek image of a factory with a cookie-shaped logo - Golden Cookie: A shiny, golden version of the cookie texture - Prestige Button: A stylized, fiery button with the word "Ascend" written in bold, golden font *Upgrades* 1. Cursor Upgrades - Name: Reinforced Fingers - Description: Increases cursor cookie production by 1 cookie per second - Initial Cost: 15 cookies - Price Increase: 1-5% per upgrade - Effect: +1 cookie per second - Texture: A simple, hand-drawn image of a pointing finger 2. Grandma Upgrades - Name: Baking Powder - Description: Increases grandma cookie production by 5 cookies per second - Initial Cost: 100 cookies - Price Increase: 1-5% per upgrade - Effect: +5 cookies per second - Texture: A warm, watercolor-style illustration of a grandma in a baking apron 3. Farm Upgrades - Name: Fertile Soil - Description: Increases farm cookie production by 10 cookies per second - Initial Cost: 500 cookies - Price Increase: 1-5% per upgrade - Effect: +10 cookies per second - Texture: A simple, cartoon-style image of a farm with rolling hills and a few trees *Custom Upgrades* 1. Cookie Crusher - Name: Double Cookie Day - Description: Doubles cookie production for 10 seconds - Cost: 500 cookies - Cooldown: 30 seconds - Effect: x2 cookie production for 10 seconds - Texture: A stylized, explosive image of a cookie shattering into pieces 2. Golden Cookie - Name: Lucky Break - Description: Gives a random bonus to cookie production (1-10 cookies per second) for 5 seconds - Cost: 1000 cookies - Cooldown: 60 seconds - Effect: +1-10 cookies per second for 5 seconds - Texture: A shiny, golden version of the cookie texture *Buildings* 1. Cursor - Name: Reinforced Fingers - Description: Produces 1 cookie per second - Initial Cost: 15 cookies - Price Increase: 1-5% per upgrade - Texture: A simple, hand-drawn image of a pointing finger 2. Grandma - Name: Baking Grandma - Description: Produces 5 cookies per second - Initial Cost: 100 cookies - Price Increase: 1-5% per upgrade - Texture: A warm, watercolor-style illustration of a grandma in a baking apron 3. Farm - Name: Cookie Farm - Description: Produces 10 cookies per second - Initial Cost: 500 cookies - Price Increase: 1-5% per upgrade - Texture: A simple, cartoon-style image of a farm with rolling hills and a few trees *Custom Buildings* 1. Cookie Mine - Name: Cookie Deposit - Description: Produces 50 cookies per second, but has a 5% chance to explode and lose 10% of cookies - Cost: 5000 cookies - Texture: A stylized, industrial-style image of a mine shaft with a cookie-shaped entrance 2. Cookie Factory - Name: Mass Production - Description: Produces 100 cookies per second, but increases cookie production cost by 10% - Cost: 10000 cookies - Texture: A modern, sleek image of a factory with a cookie-shaped logo βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1, @upit/tween.v1
User prompt
Prestige System* - Name: Ascension - Description: Reset your progress, but gain a permanent bonus to cookie production - Cost: 100,000 cookies - Effect: +10% cookie production bonus (cumulative) - Max Prestiges: 100 - Prestige Bonus Formula: Prestige Bonus = (Number of Prestiges x 10)% *Textures* - Cookie: A round, golden-brown cookie with a slight sheen - Cursor: A simple, hand-drawn image of a pointing finger - Grandma: A warm, watercolor-style illustration of a grandma in a baking apron - Farm: A simple, cartoon-style image of a farm with rolling hills and a few trees - Cookie Mine: A stylized, industrial-style image of a mine shaft with a cookie-shaped entrance - Cookie Factory: A modern, sleek image of a factory with a cookie-shaped logo - Golden Cookie: A shiny, golden version of the cookie texture - Prestige Button: A stylized, fiery button with the word "Ascend" written in bold, golden font *Upgrades* 1. Cursor Upgrades - Name: Reinforced Fingers - Description: Increases cursor cookie production by 1 cookie per second - Initial Cost: 15 cookies - Price Increase: 1-5% per upgrade - Effect: +1 cookie per second - Texture: A simple, hand-drawn image of a pointing finger 2. Grandma Upgrades - Name: Baking Powder - Description: Increases grandma cookie production by 5 cookies per second - Initial Cost: 100 cookies - Price Increase: 1-5% per upgrade - Effect: +5 cookies per second - Texture: A warm, watercolor-style illustration of a grandma in a baking apron 3. Farm Upgrades - Name: Fertile Soil - Description: Increases farm cookie production by 10 cookies per second - Initial Cost: 500 cookies - Price Increase: 1-5% per upgrade - Effect: +10 cookies per second - Texture: A simple, cartoon-style image of a farm with rolling hills and a few trees *Custom Upgrades* 1. Cookie Crusher - Name: Double Cookie Day - Description: Doubles cookie production for 10 seconds - Cost: 500 cookies - Cooldown: 30 seconds - Effect: x2 cookie production for 10 seconds - Texture: A stylized, explosive image of a cookie shattering into pieces 2. Golden Cookie - Name: Lucky Break - Description: Gives a random bonus to cookie production (1-10 cookies per second) for 5 seconds - Cost: 1000 cookies - Cooldown: 60 seconds - Effect: +1-10 cookies per second for 5 seconds - Texture: A shiny, golden version of the cookie texture *Buildings* 1. Cursor - Name: Reinforced Fingers - Description: Produces 1 cookie per second - Initial Cost: 15 cookies - Price Increase: 1-5% per upgrade - Texture: A simple, hand-drawn image of a pointing finger 2. Grandma - Name: Baking Grandma - Description: Produces 5 cookies per second - Initial Cost: 100 cookies - Price Increase: 1-5% per upgrade - Texture: A warm, watercolor-style illustration of a grandma in a baking apron 3. Farm - Name: Cookie Farm - Description: Produces 10 cookies per second - Initial Cost: 500 cookies - Price Increase: 1-5% per upgrade - Texture: A simple, cartoon-style image of a farm with rolling hills and a few trees *Custom Buildings* 1. Cookie Mine - Name: Cookie Deposit - Description: Produces 50 cookies per second, but has a 5% chance to explode and lose 10% of cookies - Cost: 5000 cookies - Texture: A stylized, industrial-style image of a mine shaft with a cookie-shaped entrance 2. Cookie Factory - Name: Mass Production - Description: Produces 100 cookies per second, but increases cookie production cost by 10% - Cost: 10000 cookies - Texture: A modern, sleek image of a factory with a cookie-shaped logo βͺπ‘ Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Cookie Tap Empire
Initial prompt
Okay I want to make a brand new game it is a cookie clicker game
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Building = Container.expand(function (buildingType, cost, cps) {
var self = Container.call(this);
self.buildingType = buildingType;
self.cost = cost;
self.baseCost = cost;
self.cookiesPerSecond = cps;
self.count = 0;
var background = self.attachAsset('upgradeButton', {
anchorX: 0,
anchorY: 0
});
var icon = self.attachAsset(buildingType, {
anchorX: 0.5,
anchorY: 0.5,
x: 40,
y: 40
});
var nameText = new Text2(buildingType.toUpperCase(), {
size: 24,
fill: 0xFFFFFF
});
nameText.anchor.set(0, 0.5);
nameText.x = 90;
nameText.y = 25;
self.addChild(nameText);
self.costText = new Text2('Cost: ' + self.cost, {
size: 20,
fill: 0xFFFF00
});
self.costText.anchor.set(0, 0.5);
self.costText.x = 90;
self.costText.y = 45;
self.addChild(self.costText);
self.countText = new Text2('Owned: ' + self.count, {
size: 18,
fill: 0xCCCCCC
});
self.countText.anchor.set(0, 0.5);
self.countText.x = 90;
self.countText.y = 65;
self.addChild(self.countText);
self.updateDisplay = function () {
self.costText.setText('Cost: ' + Math.floor(self.cost));
self.countText.setText('Owned: ' + self.count);
if (cookies >= self.cost) {
background.tint = 0x4169E1;
} else {
background.tint = 0x666666;
}
};
self.purchase = function () {
if (cookies >= self.cost) {
cookies -= self.cost;
self.count++;
totalCPS += self.cookiesPerSecond;
// Increase cost by 15%
self.cost = Math.floor(self.cost * 1.15);
LK.getSound('purchase').play();
self.updateDisplay();
updateDisplay();
saveGame();
}
};
self.down = function (x, y, obj) {
self.purchase();
};
return self;
});
var Cookie = Container.expand(function () {
var self = Container.call(this);
var cookieGraphics = self.attachAsset('cookie', {
anchorX: 0.5,
anchorY: 0.5
});
// Add detailed cookie decorations with pixel art style
var highlight = self.attachAsset('cookieHighlight', {
anchorX: 0.5,
anchorY: 0.5,
x: -40,
y: -60
});
highlight.alpha = 0.6;
var chip1 = self.attachAsset('cookieChip1', {
anchorX: 0.5,
anchorY: 0.5,
x: -50,
y: -30
});
var chip2 = self.attachAsset('cookieChip2', {
anchorX: 0.5,
anchorY: 0.5,
x: 60,
y: 40
});
var chip3 = self.attachAsset('cookieChip3', {
anchorX: 0.5,
anchorY: 0.5,
x: -20,
y: 70
});
var chip4 = self.attachAsset('cookieChip1', {
anchorX: 0.5,
anchorY: 0.5,
x: 30,
y: -50
});
var chip5 = self.attachAsset('cookieChip2', {
anchorX: 0.5,
anchorY: 0.5,
x: -70,
y: 20
});
self.originalScale = 1;
self.tap = function () {
// Enhanced scale animation with rotation
tween.stop(self, {
scaleX: true,
scaleY: true,
rotation: true
});
self.scaleX = 0.85;
self.scaleY = 0.85;
self.rotation += 0.1;
tween(self, {
scaleX: self.originalScale,
scaleY: self.originalScale,
rotation: 0
}, {
duration: 300,
easing: tween.elasticOut
});
// Color flash effect
tween.stop(cookieGraphics, {
tint: true
});
cookieGraphics.tint = 0xffff99;
tween(cookieGraphics, {
tint: 0xffffff
}, {
duration: 200
});
// Play sound
LK.getSound('cookieTap').play();
// Add cookies
var cookiesGained = cookiesPerTap * tapMultiplier;
cookies += cookiesGained;
allTimeCookies += cookiesGained;
updateDisplay();
// Show floating number
showFloatingNumber('+' + Math.floor(cookiesGained), self.x, self.y - 50);
};
self.down = function (x, y, obj) {
self.tap();
};
return self;
});
var FloatingNumber = Container.expand(function (text, startX, startY) {
var self = Container.call(this);
var numberText = new Text2(text, {
size: 40,
fill: 0xFFD700
});
numberText.anchor.set(0.5, 0.5);
self.addChild(numberText);
self.x = startX;
self.y = startY;
self.alpha = 1;
// Animate upward and fade out
tween(self, {
y: self.y - 100,
alpha: 0
}, {
duration: 1500,
easing: tween.easeOut,
onFinish: function onFinish() {
self.destroy();
}
});
return self;
});
var PrestigeButton = Container.expand(function () {
var self = Container.call(this);
var background = self.attachAsset('prestigeButton', {
anchorX: 0.5,
anchorY: 0.5
});
var titleText = new Text2('ASCEND', {
size: 28,
fill: 0xFFD700
});
titleText.anchor.set(0.5, 0.5);
self.addChild(titleText);
self.updateDisplay = function () {
var totalUpgrades = 0;
for (var i = 0; i < buildings.length; i++) {
totalUpgrades += buildings[i].count;
}
var requiredUpgrades = 100 + prestigeLevel * 10;
var hasEnoughUpgrades = totalUpgrades >= requiredUpgrades;
canPrestige = allTimeCookies >= 100000 && hasEnoughUpgrades;
if (canPrestige) {
background.tint = 0xFF4500;
background.alpha = 1;
titleText.setText('ASCEND');
} else {
background.tint = 0x666666;
background.alpha = 0.5;
if (totalUpgrades < requiredUpgrades) {
titleText.setText('Need ' + (requiredUpgrades - totalUpgrades) + ' upgrades');
} else {
var needed = 100000 - Math.floor(allTimeCookies);
titleText.setText('Need ' + needed + ' cookies');
}
}
};
self.showPrestigeMenu = function () {
if (!prestigeMenu) {
prestigeMenu = game.addChild(new PrestigeMenu());
prestigeMenu.x = 1024;
prestigeMenu.y = 1366;
}
prestigeMenu.open();
};
self.down = function (x, y, obj) {
self.showPrestigeMenu();
};
return self;
});
var PrestigeMenu = Container.expand(function () {
var self = Container.call(this);
self.isOpen = false;
// Menu border and background
var border = self.attachAsset('prestigeBorder', {
anchorX: 0.5,
anchorY: 0.5
});
var background = self.attachAsset('prestigePanel', {
anchorX: 0.5,
anchorY: 0.5
});
var titleText = new Text2('ASCENSION', {
size: 36,
fill: 0xFFD700
});
titleText.anchor.set(0.5, 0.5);
titleText.y = -100;
self.addChild(titleText);
self.reqText = new Text2('', {
size: 22,
fill: 0xFFFFFF
});
self.reqText.anchor.set(0.5, 0.5);
self.reqText.y = -40;
self.addChild(self.reqText);
self.bonusText = new Text2('', {
size: 20,
fill: 0x90EE90
});
self.bonusText.anchor.set(0.5, 0.5);
self.bonusText.y = 0;
self.addChild(self.bonusText);
// Prestige action button
var actionBtn = self.attachAsset('prestigeButton', {
anchorX: 0.5,
anchorY: 0.5,
y: 50
});
actionBtn.scaleX = 0.8;
actionBtn.scaleY = 0.8;
self.actionText = new Text2('ASCEND', {
size: 24,
fill: 0xFFFFFF
});
self.actionText.anchor.set(0.5, 0.5);
self.actionText.y = 50;
self.addChild(self.actionText);
// Close button
var closeBtn = self.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 220,
y: -130
});
var closeText = new Text2('X', {
size: 20,
fill: 0xFFFFFF
});
closeText.anchor.set(0.5, 0.5);
closeText.x = 220;
closeText.y = -130;
self.addChild(closeText);
self.updateDisplay = function () {
var totalUpgrades = 0;
for (var i = 0; i < buildings.length; i++) {
totalUpgrades += buildings[i].count;
}
var requiredUpgrades = 100 + prestigeLevel * 10;
var hasEnoughUpgrades = totalUpgrades >= requiredUpgrades;
var hasEnoughCookies = allTimeCookies >= 100000;
self.reqText.setText('Need: ' + requiredUpgrades + ' upgrades (' + totalUpgrades + '/' + requiredUpgrades + ')\n' + '& 100,000 all-time cookies (' + Math.floor(allTimeCookies) + '/100,000)');
self.bonusText.setText('Gain: +10% production bonus\nCurrent bonus: +' + Math.floor(prestigeBonus * 100) + '%');
canPrestige = hasEnoughUpgrades && hasEnoughCookies;
if (canPrestige) {
actionBtn.tint = 0xFF4500;
actionBtn.alpha = 1;
self.actionText.setText('ASCEND');
} else {
actionBtn.tint = 0x666666;
actionBtn.alpha = 0.5;
self.actionText.setText('REQUIREMENTS NOT MET');
}
};
self.prestige = function () {
if (!canPrestige) return;
// Reset game state
cookies = 0;
totalCPS = 0;
for (var i = 0; i < buildings.length; i++) {
buildings[i].count = 0;
buildings[i].cost = buildings[i].baseCost;
}
// Increase prestige
prestigeLevel++;
prestigeBonus = prestigeLevel * 0.1;
allTimeCookies = 0;
canPrestige = false;
// Apply prestige bonus to tap multiplier
tapMultiplier = 1 + prestigeBonus;
LK.getSound('prestige').play();
updateDisplay();
saveGame();
// Flash effect and close menu
LK.effects.flashScreen(0xFFD700, 1000);
self.close();
};
self.open = function () {
self.isOpen = true;
self.alpha = 0;
self.visible = true;
self.updateDisplay();
tween(self, {
alpha: 1
}, {
duration: 300
});
};
self.close = function () {
self.isOpen = false;
tween(self, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
};
actionBtn.down = function () {
self.prestige();
};
self.actionText.down = function () {
self.prestige();
};
closeBtn.down = function () {
self.close();
};
closeText.down = function () {
self.close();
};
self.visible = false;
return self;
});
var UpgradeMenu = Container.expand(function () {
var self = Container.call(this);
self.isOpen = false;
self.scrollY = 0;
self.maxScroll = 0;
// Menu background panel
var menuBg = self.attachAsset('menuPanel', {
anchorX: 0.5,
anchorY: 0
});
// Menu header
var headerBg = self.attachAsset('menuHeader', {
anchorX: 0.5,
anchorY: 0,
y: 0
});
var headerText = new Text2('UPGRADES', {
size: 36,
fill: 0xFFD700
});
headerText.anchor.set(0.5, 0.5);
headerText.x = 0;
headerText.y = 40;
self.addChild(headerText);
// Close button
var closeBtn = self.attachAsset('closeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 260,
y: 40
});
var closeText = new Text2('X', {
size: 24,
fill: 0xFFFFFF
});
closeText.anchor.set(0.5, 0.5);
closeText.x = 260;
closeText.y = 40;
self.addChild(closeText);
// Content container for scrolling
self.contentContainer = new Container();
self.contentContainer.y = 80;
self.addChild(self.contentContainer);
// Scroll bar
self.scrollBar = self.attachAsset('scrollBar', {
anchorX: 0.5,
anchorY: 0,
x: 290,
y: 80
});
self.updateContent = function () {
// Clear existing content
while (self.contentContainer.children.length > 0) {
self.contentContainer.children[0].destroy();
}
var yPos = 0;
for (var i = 0; i < buildings.length; i++) {
var building = buildings[i];
var slot = self.contentContainer.addChild(LK.getAsset('upgradeSlot', {
anchorX: 0.5,
anchorY: 0,
y: yPos
}));
// Building icon with pixel details
var iconBg = self.contentContainer.addChild(LK.getAsset('upgradeIcon', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: yPos + 50
}));
// Add detailed building graphics
if (building.buildingType === 'grandma') {
var body = self.contentContainer.addChild(LK.getAsset('grandmaBody', {
anchorX: 0.5,
anchorY: 1,
x: -200,
y: yPos + 80
}));
var head = self.contentContainer.addChild(LK.getAsset('grandmaHead', {
anchorX: 0.5,
anchorY: 1,
x: -200,
y: yPos + 30
}));
var apron = self.contentContainer.addChild(LK.getAsset('grandmaApron', {
anchorX: 0.5,
anchorY: 1,
x: -200,
y: yPos + 75
}));
} else if (building.buildingType === 'oven') {
var base = self.contentContainer.addChild(LK.getAsset('ovenBase', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: yPos + 50
}));
var door = self.contentContainer.addChild(LK.getAsset('ovenDoor', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: yPos + 55
}));
var knob = self.contentContainer.addChild(LK.getAsset('ovenKnob', {
anchorX: 0.5,
anchorY: 0.5,
x: -170,
y: yPos + 35
}));
} else if (building.buildingType === 'factory') {
var factoryBase = self.contentContainer.addChild(LK.getAsset('factoryBase', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: yPos + 50
}));
var chimney = self.contentContainer.addChild(LK.getAsset('factoryChimney', {
anchorX: 0.5,
anchorY: 1,
x: -180,
y: yPos + 10
}));
var window = self.contentContainer.addChild(LK.getAsset('factoryWindow', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: yPos + 40
}));
}
var nameText = new Text2(building.buildingType.toUpperCase(), {
size: 28,
fill: 0xFFFFFF
});
nameText.anchor.set(0, 0.5);
nameText.x = -100;
nameText.y = yPos + 25;
self.contentContainer.addChild(nameText);
var costText = new Text2('Cost: ' + Math.floor(building.cost), {
size: 22,
fill: 0xFFFF00
});
costText.anchor.set(0, 0.5);
costText.x = -100;
costText.y = yPos + 50;
self.contentContainer.addChild(costText);
var ownedText = new Text2('Owned: ' + building.count, {
size: 20,
fill: 0xCCCCCC
});
ownedText.anchor.set(0, 0.5);
ownedText.x = -100;
ownedText.y = yPos + 75;
self.contentContainer.addChild(ownedText);
// Purchase functionality
slot.buildingRef = building;
slot.down = function (x, y, obj) {
this.buildingRef.purchase();
upgradeMenu.updateContent();
};
yPos += 120;
}
self.maxScroll = Math.max(0, yPos - 1400);
self.updateScrollBar();
};
self.updateScrollBar = function () {
if (self.maxScroll > 0) {
var scrollPercent = self.scrollY / self.maxScroll;
self.scrollBar.y = 80 + scrollPercent * 1300;
self.scrollBar.alpha = 1;
} else {
self.scrollBar.alpha = 0.3;
}
};
self.scroll = function (deltaY) {
self.scrollY = Math.max(0, Math.min(self.maxScroll, self.scrollY + deltaY));
self.contentContainer.y = 80 - self.scrollY;
self.updateScrollBar();
};
self.open = function () {
self.isOpen = true;
self.alpha = 0;
self.visible = true;
self.updateContent();
tween(self, {
alpha: 1
}, {
duration: 300
});
};
self.close = function () {
self.isOpen = false;
tween(self, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.visible = false;
}
});
};
// Handle close button
closeBtn.down = function () {
self.close();
};
closeText.down = function () {
self.close();
};
// Handle scrolling via touch/drag
self.lastY = 0;
self.isDragging = false;
self.down = function (x, y, obj) {
self.lastY = y;
self.isDragging = true;
};
self.move = function (x, y, obj) {
if (self.isDragging) {
var deltaY = y - self.lastY;
self.scroll(-deltaY * 2);
self.lastY = y;
}
};
self.up = function (x, y, obj) {
self.isDragging = false;
};
self.visible = false;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Menu buttons
// UI Elements
// Building pixel textures
// Custom pixel-style cookie textures
// Game variables
var cookies = storage.cookies || 0;
var totalCPS = storage.totalCPS || 0;
var cookiesPerTap = 1;
var tapMultiplier = 1;
// Prestige system variables
var prestigeLevel = storage.prestigeLevel || 0;
var prestigeBonus = prestigeLevel * 0.1; // 10% bonus per prestige
var allTimeCookies = storage.allTimeCookies || 0;
var canPrestige = false;
// Buildings data
var buildingsData = [{
type: 'grandma',
cost: 15,
cps: 1
}, {
type: 'oven',
cost: 100,
cps: 8
}, {
type: 'factory',
cost: 1100,
cps: 47
}];
var buildings = [];
var floatingNumbers = [];
// Create custom HUD background
var hudBg = LK.getAsset('hudBackground', {
anchorX: 0,
anchorY: 0
});
hudBg.alpha = 0.9;
LK.gui.top.addChild(hudBg);
// Create cookie (centered and larger)
var mainCookie = game.addChild(new Cookie());
mainCookie.x = 1024;
mainCookie.y = 1200;
mainCookie.scaleX = 1.5;
mainCookie.scaleY = 1.5;
// Custom UI with styled backgrounds
var cookieCounterBg = LK.getAsset('cookieCounter', {
anchorX: 0.5,
anchorY: 0.5
});
cookieCounterBg.x = 1024;
cookieCounterBg.y = 60;
LK.gui.top.addChild(cookieCounterBg);
var cookieDisplay = new Text2('Cookies: 0', {
size: 42,
fill: 0xFFD700
});
cookieDisplay.anchor.set(0.5, 0.5);
cookieDisplay.x = 1024;
cookieDisplay.y = 60;
LK.gui.top.addChild(cookieDisplay);
var cpsCounterBg = LK.getAsset('cpsCounter', {
anchorX: 0.5,
anchorY: 0.5
});
cpsCounterBg.x = 1024;
cpsCounterBg.y = 120;
LK.gui.top.addChild(cpsCounterBg);
var cpsDisplay = new Text2('Per second: 0', {
size: 28,
fill: 0x90EE90
});
cpsDisplay.anchor.set(0.5, 0.5);
cpsDisplay.x = 1024;
cpsDisplay.y = 120;
LK.gui.top.addChild(cpsDisplay);
// Prestige display
var prestigeDisplay = new Text2('Prestige Level: 0 (+0% bonus)', {
size: 22,
fill: 0xFFD700
});
prestigeDisplay.anchor.set(0.5, 0.5);
prestigeDisplay.x = 1024;
prestigeDisplay.y = 170;
LK.gui.top.addChild(prestigeDisplay);
// Menu button (top right, avoiding top-left reserved area)
var menuButton = LK.getAsset('menuButton', {
anchorX: 1,
anchorY: 0
});
menuButton.x = 2048 - 20;
menuButton.y = 20;
LK.gui.topRight.addChild(menuButton);
var menuText = new Text2('SHOP', {
size: 20,
fill: 0xFFFFFF
});
menuText.anchor.set(0.5, 0.5);
menuText.x = -60;
menuText.y = 30;
LK.gui.topRight.addChild(menuText);
// Create upgrade menu (initially hidden)
var upgradeMenu = game.addChild(new UpgradeMenu());
upgradeMenu.x = 1024;
upgradeMenu.y = 400;
// Create prestige button (bottom of screen)
var prestigeButton = new PrestigeButton();
prestigeButton.x = 1024;
prestigeButton.y = 2600;
game.addChild(prestigeButton);
// Menu functionality
var prestigeMenu = null;
menuButton.down = function () {
if (upgradeMenu.isOpen) {
upgradeMenu.close();
} else {
upgradeMenu.open();
}
};
menuText.down = function () {
if (upgradeMenu.isOpen) {
upgradeMenu.close();
} else {
upgradeMenu.open();
}
};
// Create buildings (no longer displayed directly, managed by upgrade menu)
for (var i = 0; i < buildingsData.length; i++) {
var buildingData = buildingsData[i];
var building = new Building(buildingData.type, buildingData.cost, buildingData.cps);
// Load saved data
var savedCount = storage['building_' + buildingData.type] || 0;
if (savedCount > 0) {
building.count = savedCount;
building.cost = Math.floor(building.baseCost * Math.pow(1.15, savedCount));
totalCPS += building.cookiesPerSecond * savedCount;
}
buildings.push(building);
}
// Game functions
function updateDisplay() {
cookieDisplay.setText('Cookies: ' + Math.floor(cookies));
cpsDisplay.setText('Per second: ' + totalCPS);
prestigeDisplay.setText('Prestige Level: ' + prestigeLevel + ' (+' + Math.floor(prestigeBonus * 100) + '% bonus)');
for (var i = 0; i < buildings.length; i++) {
buildings[i].updateDisplay();
}
prestigeButton.updateDisplay();
if (upgradeMenu && upgradeMenu.isOpen) {
upgradeMenu.updateContent();
}
if (prestigeMenu && prestigeMenu.isOpen) {
prestigeMenu.updateDisplay();
}
}
function showFloatingNumber(text, x, y) {
var floatingNum = new FloatingNumber(text, x, y);
game.addChild(floatingNum);
floatingNumbers.push(floatingNum);
}
function saveGame() {
storage.cookies = cookies;
storage.totalCPS = totalCPS;
storage.prestigeLevel = prestigeLevel;
storage.allTimeCookies = allTimeCookies;
for (var i = 0; i < buildings.length; i++) {
storage['building_' + buildings[i].buildingType] = buildings[i].count;
}
}
// Auto-save timer
var saveTimer = LK.setInterval(function () {
saveGame();
}, 5000);
// CPS generation timer
var cpsTimer = LK.setInterval(function () {
if (totalCPS > 0) {
var cpsGain = totalCPS * tapMultiplier / 10; // 10 times per second for smoother increments
cookies += cpsGain;
allTimeCookies += cpsGain;
updateDisplay();
}
}, 100);
// Initial display update
updateDisplay();
game.update = function () {
// Clean up destroyed floating numbers
for (var i = floatingNumbers.length - 1; i >= 0; i--) {
if (floatingNumbers[i].destroyed) {
floatingNumbers.splice(i, 1);
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -80,43 +80,75 @@
var cookieGraphics = self.attachAsset('cookie', {
anchorX: 0.5,
anchorY: 0.5
});
- // Add cookie bite decorations
- var bite1 = self.attachAsset('cookieBite', {
+ // Add detailed cookie decorations with pixel art style
+ var highlight = self.attachAsset('cookieHighlight', {
anchorX: 0.5,
anchorY: 0.5,
- x: -80,
+ x: -40,
y: -60
});
- var bite2 = self.attachAsset('cookieBite', {
+ highlight.alpha = 0.6;
+ var chip1 = self.attachAsset('cookieChip1', {
anchorX: 0.5,
anchorY: 0.5,
- x: 70,
- y: 80
+ x: -50,
+ y: -30
});
- var bite3 = self.attachAsset('cookieBite', {
+ var chip2 = self.attachAsset('cookieChip2', {
anchorX: 0.5,
anchorY: 0.5,
- x: -30,
- y: 90
+ x: 60,
+ y: 40
});
+ var chip3 = self.attachAsset('cookieChip3', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -20,
+ y: 70
+ });
+ var chip4 = self.attachAsset('cookieChip1', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 30,
+ y: -50
+ });
+ var chip5 = self.attachAsset('cookieChip2', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -70,
+ y: 20
+ });
self.originalScale = 1;
self.tap = function () {
- // Scale animation
+ // Enhanced scale animation with rotation
tween.stop(self, {
scaleX: true,
- scaleY: true
+ scaleY: true,
+ rotation: true
});
- self.scaleX = 0.9;
- self.scaleY = 0.9;
+ self.scaleX = 0.85;
+ self.scaleY = 0.85;
+ self.rotation += 0.1;
tween(self, {
scaleX: self.originalScale,
- scaleY: self.originalScale
+ scaleY: self.originalScale,
+ rotation: 0
}, {
- duration: 200,
- easing: tween.bounceOut
+ duration: 300,
+ easing: tween.elasticOut
});
+ // Color flash effect
+ tween.stop(cookieGraphics, {
+ tint: true
+ });
+ cookieGraphics.tint = 0xffff99;
+ tween(cookieGraphics, {
+ tint: 0xffffff
+ }, {
+ duration: 200
+ });
// Play sound
LK.getSound('cookieTap').play();
// Add cookies
var cookiesGained = cookiesPerTap * tapMultiplier;
@@ -161,32 +193,133 @@
anchorX: 0.5,
anchorY: 0.5
});
var titleText = new Text2('ASCEND', {
- size: 32,
+ size: 28,
fill: 0xFFD700
});
- titleText.anchor.set(0.5, 0.3);
+ titleText.anchor.set(0.5, 0.5);
self.addChild(titleText);
- self.descText = new Text2('Reset for +10% bonus', {
- size: 18,
- fill: 0xFFFFFF
- });
- self.descText.anchor.set(0.5, 0.7);
- self.addChild(self.descText);
self.updateDisplay = function () {
- canPrestige = allTimeCookies >= 100000;
+ var totalUpgrades = 0;
+ for (var i = 0; i < buildings.length; i++) {
+ totalUpgrades += buildings[i].count;
+ }
+ var requiredUpgrades = 100 + prestigeLevel * 10;
+ var hasEnoughUpgrades = totalUpgrades >= requiredUpgrades;
+ canPrestige = allTimeCookies >= 100000 && hasEnoughUpgrades;
if (canPrestige) {
background.tint = 0xFF4500;
background.alpha = 1;
- self.descText.setText('Reset for +10% bonus');
+ titleText.setText('ASCEND');
} else {
background.tint = 0x666666;
background.alpha = 0.5;
- var needed = 100000 - Math.floor(allTimeCookies);
- self.descText.setText('Need ' + needed + ' more cookies');
+ if (totalUpgrades < requiredUpgrades) {
+ titleText.setText('Need ' + (requiredUpgrades - totalUpgrades) + ' upgrades');
+ } else {
+ var needed = 100000 - Math.floor(allTimeCookies);
+ titleText.setText('Need ' + needed + ' cookies');
+ }
}
};
+ self.showPrestigeMenu = function () {
+ if (!prestigeMenu) {
+ prestigeMenu = game.addChild(new PrestigeMenu());
+ prestigeMenu.x = 1024;
+ prestigeMenu.y = 1366;
+ }
+ prestigeMenu.open();
+ };
+ self.down = function (x, y, obj) {
+ self.showPrestigeMenu();
+ };
+ return self;
+});
+var PrestigeMenu = Container.expand(function () {
+ var self = Container.call(this);
+ self.isOpen = false;
+ // Menu border and background
+ var border = self.attachAsset('prestigeBorder', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var background = self.attachAsset('prestigePanel', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ var titleText = new Text2('ASCENSION', {
+ size: 36,
+ fill: 0xFFD700
+ });
+ titleText.anchor.set(0.5, 0.5);
+ titleText.y = -100;
+ self.addChild(titleText);
+ self.reqText = new Text2('', {
+ size: 22,
+ fill: 0xFFFFFF
+ });
+ self.reqText.anchor.set(0.5, 0.5);
+ self.reqText.y = -40;
+ self.addChild(self.reqText);
+ self.bonusText = new Text2('', {
+ size: 20,
+ fill: 0x90EE90
+ });
+ self.bonusText.anchor.set(0.5, 0.5);
+ self.bonusText.y = 0;
+ self.addChild(self.bonusText);
+ // Prestige action button
+ var actionBtn = self.attachAsset('prestigeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ y: 50
+ });
+ actionBtn.scaleX = 0.8;
+ actionBtn.scaleY = 0.8;
+ self.actionText = new Text2('ASCEND', {
+ size: 24,
+ fill: 0xFFFFFF
+ });
+ self.actionText.anchor.set(0.5, 0.5);
+ self.actionText.y = 50;
+ self.addChild(self.actionText);
+ // Close button
+ var closeBtn = self.attachAsset('closeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 220,
+ y: -130
+ });
+ var closeText = new Text2('X', {
+ size: 20,
+ fill: 0xFFFFFF
+ });
+ closeText.anchor.set(0.5, 0.5);
+ closeText.x = 220;
+ closeText.y = -130;
+ self.addChild(closeText);
+ self.updateDisplay = function () {
+ var totalUpgrades = 0;
+ for (var i = 0; i < buildings.length; i++) {
+ totalUpgrades += buildings[i].count;
+ }
+ var requiredUpgrades = 100 + prestigeLevel * 10;
+ var hasEnoughUpgrades = totalUpgrades >= requiredUpgrades;
+ var hasEnoughCookies = allTimeCookies >= 100000;
+ self.reqText.setText('Need: ' + requiredUpgrades + ' upgrades (' + totalUpgrades + '/' + requiredUpgrades + ')\n' + '& 100,000 all-time cookies (' + Math.floor(allTimeCookies) + '/100,000)');
+ self.bonusText.setText('Gain: +10% production bonus\nCurrent bonus: +' + Math.floor(prestigeBonus * 100) + '%');
+ canPrestige = hasEnoughUpgrades && hasEnoughCookies;
+ if (canPrestige) {
+ actionBtn.tint = 0xFF4500;
+ actionBtn.alpha = 1;
+ self.actionText.setText('ASCEND');
+ } else {
+ actionBtn.tint = 0x666666;
+ actionBtn.alpha = 0.5;
+ self.actionText.setText('REQUIREMENTS NOT MET');
+ }
+ };
self.prestige = function () {
if (!canPrestige) return;
// Reset game state
cookies = 0;
@@ -204,16 +337,276 @@
tapMultiplier = 1 + prestigeBonus;
LK.getSound('prestige').play();
updateDisplay();
saveGame();
- // Flash effect
+ // Flash effect and close menu
LK.effects.flashScreen(0xFFD700, 1000);
+ self.close();
};
- self.down = function (x, y, obj) {
+ self.open = function () {
+ self.isOpen = true;
+ self.alpha = 0;
+ self.visible = true;
+ self.updateDisplay();
+ tween(self, {
+ alpha: 1
+ }, {
+ duration: 300
+ });
+ };
+ self.close = function () {
+ self.isOpen = false;
+ tween(self, {
+ alpha: 0
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.visible = false;
+ }
+ });
+ };
+ actionBtn.down = function () {
self.prestige();
};
+ self.actionText.down = function () {
+ self.prestige();
+ };
+ closeBtn.down = function () {
+ self.close();
+ };
+ closeText.down = function () {
+ self.close();
+ };
+ self.visible = false;
return self;
});
+var UpgradeMenu = Container.expand(function () {
+ var self = Container.call(this);
+ self.isOpen = false;
+ self.scrollY = 0;
+ self.maxScroll = 0;
+ // Menu background panel
+ var menuBg = self.attachAsset('menuPanel', {
+ anchorX: 0.5,
+ anchorY: 0
+ });
+ // Menu header
+ var headerBg = self.attachAsset('menuHeader', {
+ anchorX: 0.5,
+ anchorY: 0,
+ y: 0
+ });
+ var headerText = new Text2('UPGRADES', {
+ size: 36,
+ fill: 0xFFD700
+ });
+ headerText.anchor.set(0.5, 0.5);
+ headerText.x = 0;
+ headerText.y = 40;
+ self.addChild(headerText);
+ // Close button
+ var closeBtn = self.attachAsset('closeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: 260,
+ y: 40
+ });
+ var closeText = new Text2('X', {
+ size: 24,
+ fill: 0xFFFFFF
+ });
+ closeText.anchor.set(0.5, 0.5);
+ closeText.x = 260;
+ closeText.y = 40;
+ self.addChild(closeText);
+ // Content container for scrolling
+ self.contentContainer = new Container();
+ self.contentContainer.y = 80;
+ self.addChild(self.contentContainer);
+ // Scroll bar
+ self.scrollBar = self.attachAsset('scrollBar', {
+ anchorX: 0.5,
+ anchorY: 0,
+ x: 290,
+ y: 80
+ });
+ self.updateContent = function () {
+ // Clear existing content
+ while (self.contentContainer.children.length > 0) {
+ self.contentContainer.children[0].destroy();
+ }
+ var yPos = 0;
+ for (var i = 0; i < buildings.length; i++) {
+ var building = buildings[i];
+ var slot = self.contentContainer.addChild(LK.getAsset('upgradeSlot', {
+ anchorX: 0.5,
+ anchorY: 0,
+ y: yPos
+ }));
+ // Building icon with pixel details
+ var iconBg = self.contentContainer.addChild(LK.getAsset('upgradeIcon', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -200,
+ y: yPos + 50
+ }));
+ // Add detailed building graphics
+ if (building.buildingType === 'grandma') {
+ var body = self.contentContainer.addChild(LK.getAsset('grandmaBody', {
+ anchorX: 0.5,
+ anchorY: 1,
+ x: -200,
+ y: yPos + 80
+ }));
+ var head = self.contentContainer.addChild(LK.getAsset('grandmaHead', {
+ anchorX: 0.5,
+ anchorY: 1,
+ x: -200,
+ y: yPos + 30
+ }));
+ var apron = self.contentContainer.addChild(LK.getAsset('grandmaApron', {
+ anchorX: 0.5,
+ anchorY: 1,
+ x: -200,
+ y: yPos + 75
+ }));
+ } else if (building.buildingType === 'oven') {
+ var base = self.contentContainer.addChild(LK.getAsset('ovenBase', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -200,
+ y: yPos + 50
+ }));
+ var door = self.contentContainer.addChild(LK.getAsset('ovenDoor', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -200,
+ y: yPos + 55
+ }));
+ var knob = self.contentContainer.addChild(LK.getAsset('ovenKnob', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -170,
+ y: yPos + 35
+ }));
+ } else if (building.buildingType === 'factory') {
+ var factoryBase = self.contentContainer.addChild(LK.getAsset('factoryBase', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -200,
+ y: yPos + 50
+ }));
+ var chimney = self.contentContainer.addChild(LK.getAsset('factoryChimney', {
+ anchorX: 0.5,
+ anchorY: 1,
+ x: -180,
+ y: yPos + 10
+ }));
+ var window = self.contentContainer.addChild(LK.getAsset('factoryWindow', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ x: -200,
+ y: yPos + 40
+ }));
+ }
+ var nameText = new Text2(building.buildingType.toUpperCase(), {
+ size: 28,
+ fill: 0xFFFFFF
+ });
+ nameText.anchor.set(0, 0.5);
+ nameText.x = -100;
+ nameText.y = yPos + 25;
+ self.contentContainer.addChild(nameText);
+ var costText = new Text2('Cost: ' + Math.floor(building.cost), {
+ size: 22,
+ fill: 0xFFFF00
+ });
+ costText.anchor.set(0, 0.5);
+ costText.x = -100;
+ costText.y = yPos + 50;
+ self.contentContainer.addChild(costText);
+ var ownedText = new Text2('Owned: ' + building.count, {
+ size: 20,
+ fill: 0xCCCCCC
+ });
+ ownedText.anchor.set(0, 0.5);
+ ownedText.x = -100;
+ ownedText.y = yPos + 75;
+ self.contentContainer.addChild(ownedText);
+ // Purchase functionality
+ slot.buildingRef = building;
+ slot.down = function (x, y, obj) {
+ this.buildingRef.purchase();
+ upgradeMenu.updateContent();
+ };
+ yPos += 120;
+ }
+ self.maxScroll = Math.max(0, yPos - 1400);
+ self.updateScrollBar();
+ };
+ self.updateScrollBar = function () {
+ if (self.maxScroll > 0) {
+ var scrollPercent = self.scrollY / self.maxScroll;
+ self.scrollBar.y = 80 + scrollPercent * 1300;
+ self.scrollBar.alpha = 1;
+ } else {
+ self.scrollBar.alpha = 0.3;
+ }
+ };
+ self.scroll = function (deltaY) {
+ self.scrollY = Math.max(0, Math.min(self.maxScroll, self.scrollY + deltaY));
+ self.contentContainer.y = 80 - self.scrollY;
+ self.updateScrollBar();
+ };
+ self.open = function () {
+ self.isOpen = true;
+ self.alpha = 0;
+ self.visible = true;
+ self.updateContent();
+ tween(self, {
+ alpha: 1
+ }, {
+ duration: 300
+ });
+ };
+ self.close = function () {
+ self.isOpen = false;
+ tween(self, {
+ alpha: 0
+ }, {
+ duration: 300,
+ onFinish: function onFinish() {
+ self.visible = false;
+ }
+ });
+ };
+ // Handle close button
+ closeBtn.down = function () {
+ self.close();
+ };
+ closeText.down = function () {
+ self.close();
+ };
+ // Handle scrolling via touch/drag
+ self.lastY = 0;
+ self.isDragging = false;
+ self.down = function (x, y, obj) {
+ self.lastY = y;
+ self.isDragging = true;
+ };
+ self.move = function (x, y, obj) {
+ if (self.isDragging) {
+ var deltaY = y - self.lastY;
+ self.scroll(-deltaY * 2);
+ self.lastY = y;
+ }
+ };
+ self.up = function (x, y, obj) {
+ self.isDragging = false;
+ };
+ self.visible = false;
+ return self;
+});
/****
* Initialize Game
****/
@@ -223,8 +616,12 @@
/****
* Game Code
****/
+// Menu buttons
+// UI Elements
+// Building pixel textures
+// Custom pixel-style cookie textures
// Game variables
var cookies = storage.cookies || 0;
var totalCPS = storage.totalCPS || 0;
var cookiesPerTap = 1;
@@ -249,55 +646,114 @@
cps: 47
}];
var buildings = [];
var floatingNumbers = [];
-// Create cookie
+// Create custom HUD background
+var hudBg = LK.getAsset('hudBackground', {
+ anchorX: 0,
+ anchorY: 0
+});
+hudBg.alpha = 0.9;
+LK.gui.top.addChild(hudBg);
+// Create cookie (centered and larger)
var mainCookie = game.addChild(new Cookie());
mainCookie.x = 1024;
-mainCookie.y = 600;
-// Create UI
+mainCookie.y = 1200;
+mainCookie.scaleX = 1.5;
+mainCookie.scaleY = 1.5;
+// Custom UI with styled backgrounds
+var cookieCounterBg = LK.getAsset('cookieCounter', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+cookieCounterBg.x = 1024;
+cookieCounterBg.y = 60;
+LK.gui.top.addChild(cookieCounterBg);
var cookieDisplay = new Text2('Cookies: 0', {
- size: 60,
- fill: 0x8B4513
+ size: 42,
+ fill: 0xFFD700
});
-cookieDisplay.anchor.set(0.5, 0);
+cookieDisplay.anchor.set(0.5, 0.5);
+cookieDisplay.x = 1024;
+cookieDisplay.y = 60;
LK.gui.top.addChild(cookieDisplay);
-cookieDisplay.y = 50;
+var cpsCounterBg = LK.getAsset('cpsCounter', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+cpsCounterBg.x = 1024;
+cpsCounterBg.y = 120;
+LK.gui.top.addChild(cpsCounterBg);
var cpsDisplay = new Text2('Per second: 0', {
- size: 30,
- fill: 0x654321
+ size: 28,
+ fill: 0x90EE90
});
-cpsDisplay.anchor.set(0.5, 0);
-LK.gui.top.addChild(cpsDisplay);
+cpsDisplay.anchor.set(0.5, 0.5);
+cpsDisplay.x = 1024;
cpsDisplay.y = 120;
+LK.gui.top.addChild(cpsDisplay);
// Prestige display
var prestigeDisplay = new Text2('Prestige Level: 0 (+0% bonus)', {
- size: 24,
+ size: 22,
fill: 0xFFD700
});
-prestigeDisplay.anchor.set(0.5, 0);
+prestigeDisplay.anchor.set(0.5, 0.5);
+prestigeDisplay.x = 1024;
+prestigeDisplay.y = 170;
LK.gui.top.addChild(prestigeDisplay);
-prestigeDisplay.y = 160;
-// Create prestige button
+// Menu button (top right, avoiding top-left reserved area)
+var menuButton = LK.getAsset('menuButton', {
+ anchorX: 1,
+ anchorY: 0
+});
+menuButton.x = 2048 - 20;
+menuButton.y = 20;
+LK.gui.topRight.addChild(menuButton);
+var menuText = new Text2('SHOP', {
+ size: 20,
+ fill: 0xFFFFFF
+});
+menuText.anchor.set(0.5, 0.5);
+menuText.x = -60;
+menuText.y = 30;
+LK.gui.topRight.addChild(menuText);
+// Create upgrade menu (initially hidden)
+var upgradeMenu = game.addChild(new UpgradeMenu());
+upgradeMenu.x = 1024;
+upgradeMenu.y = 400;
+// Create prestige button (bottom of screen)
var prestigeButton = new PrestigeButton();
prestigeButton.x = 1024;
-prestigeButton.y = 400;
+prestigeButton.y = 2600;
game.addChild(prestigeButton);
-// Create buildings
+// Menu functionality
+var prestigeMenu = null;
+menuButton.down = function () {
+ if (upgradeMenu.isOpen) {
+ upgradeMenu.close();
+ } else {
+ upgradeMenu.open();
+ }
+};
+menuText.down = function () {
+ if (upgradeMenu.isOpen) {
+ upgradeMenu.close();
+ } else {
+ upgradeMenu.open();
+ }
+};
+// Create buildings (no longer displayed directly, managed by upgrade menu)
for (var i = 0; i < buildingsData.length; i++) {
var buildingData = buildingsData[i];
var building = new Building(buildingData.type, buildingData.cost, buildingData.cps);
- building.x = 100;
- building.y = 1800 + i * 120;
// Load saved data
var savedCount = storage['building_' + buildingData.type] || 0;
if (savedCount > 0) {
building.count = savedCount;
building.cost = Math.floor(building.baseCost * Math.pow(1.15, savedCount));
totalCPS += building.cookiesPerSecond * savedCount;
}
buildings.push(building);
- game.addChild(building);
}
// Game functions
function updateDisplay() {
cookieDisplay.setText('Cookies: ' + Math.floor(cookies));
@@ -306,8 +762,14 @@
for (var i = 0; i < buildings.length; i++) {
buildings[i].updateDisplay();
}
prestigeButton.updateDisplay();
+ if (upgradeMenu && upgradeMenu.isOpen) {
+ upgradeMenu.updateContent();
+ }
+ if (prestigeMenu && prestigeMenu.isOpen) {
+ prestigeMenu.updateDisplay();
+ }
}
function showFloatingNumber(text, x, y) {
var floatingNum = new FloatingNumber(text, x, y);
game.addChild(floatingNum);