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 * (1 + prestigeBonus);
// 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 cookie bite decorations
var bite1 = self.attachAsset('cookieBite', {
anchorX: 0.5,
anchorY: 0.5,
x: -80,
y: -60
});
var bite2 = self.attachAsset('cookieBite', {
anchorX: 0.5,
anchorY: 0.5,
x: 70,
y: 80
});
var bite3 = self.attachAsset('cookieBite', {
anchorX: 0.5,
anchorY: 0.5,
x: -30,
y: 90
});
self.originalScale = 1;
self.tap = function () {
// Scale animation
tween.stop(self, {
scaleX: true,
scaleY: true
});
self.scaleX = 0.9;
self.scaleY = 0.9;
tween(self, {
scaleX: self.originalScale,
scaleY: self.originalScale
}, {
duration: 200,
easing: tween.bounceOut
});
// Play sound
LK.getSound('cookieTap').play();
// Add cookies with prestige bonus
cookies += cookiesPerTap * tapMultiplier * (1 + prestigeBonus);
updateDisplay();
// Show floating number
var earnedCookies = Math.floor(cookiesPerTap * tapMultiplier * (1 + prestigeBonus));
showFloatingNumber('+' + earnedCookies, 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('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 0.8
});
var buttonText = new Text2('ASCEND', {
size: 32,
fill: 0xFFD700
});
buttonText.anchor.set(0.5, 0.3);
self.addChild(buttonText);
self.costText = new Text2('Cost: 100,000', {
size: 20,
fill: 0xFFFFFF
});
self.costText.anchor.set(0.5, 0.7);
self.addChild(self.costText);
self.updateDisplay = function () {
var canPrestige = cookies >= 100000 && prestiges < 100;
if (canPrestige) {
background.tint = 0xFF4500;
} else {
background.tint = 0x666666;
}
if (prestiges >= 100) {
self.costText.setText('MAX PRESTIGES');
} else {
self.costText.setText('Cost: 100,000');
}
};
self.prestige = function () {
if (cookies >= 100000 && prestiges < 100) {
// Reset progress
cookies = 0;
totalCPS = 0;
// Reset all buildings
for (var i = 0; i < buildings.length; i++) {
buildings[i].count = 0;
buildings[i].cost = buildings[i].baseCost;
}
// Add prestige
prestiges++;
prestigeBonus = prestiges * 0.1;
// Update displays
updateDisplay();
saveGame();
}
};
self.down = function (x, y, obj) {
self.prestige();
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var cookies = storage.cookies || 0;
var totalCPS = storage.totalCPS || 0;
var cookiesPerTap = 1;
var tapMultiplier = 1;
var prestiges = storage.prestiges || 0;
var prestigeBonus = prestiges * 0.1; // 10% bonus per prestige
// 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 cookie
var mainCookie = game.addChild(new Cookie());
mainCookie.x = 1024;
mainCookie.y = 600;
// Create UI
var cookieDisplay = new Text2('Cookies: 0', {
size: 60,
fill: 0x8B4513
});
cookieDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(cookieDisplay);
cookieDisplay.y = 50;
var cpsDisplay = new Text2('Per second: 0', {
size: 30,
fill: 0x654321
});
cpsDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(cpsDisplay);
cpsDisplay.y = 120;
// Create prestige display
var prestigeDisplay = new Text2('Prestiges: 0 (+0% bonus)', {
size: 24,
fill: 0x4B0082
});
prestigeDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(prestigeDisplay);
prestigeDisplay.y = 160;
// Create prestige button
var prestigeButton = new PrestigeButton();
prestigeButton.x = 1024;
prestigeButton.y = 2400;
game.addChild(prestigeButton);
// Create buildings
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 * (1 + prestigeBonus);
}
buildings.push(building);
game.addChild(building);
}
// Game functions
function updateDisplay() {
cookieDisplay.setText('Cookies: ' + Math.floor(cookies));
cpsDisplay.setText('Per second: ' + totalCPS);
for (var i = 0; i < buildings.length; i++) {
buildings[i].updateDisplay();
}
// Update prestige display
prestigeDisplay.setText('Prestiges: ' + prestiges + ' (+' + Math.floor(prestigeBonus * 100) + '% bonus)');
prestigeButton.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.prestiges = prestiges;
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) {
cookies += totalCPS / 10; // 10 times per second for smoother increments
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
@@ -60,9 +60,9 @@
self.purchase = function () {
if (cookies >= self.cost) {
cookies -= self.cost;
self.count++;
- totalCPS += self.cookiesPerSecond;
+ totalCPS += self.cookiesPerSecond * (1 + prestigeBonus);
// Increase cost by 15%
self.cost = Math.floor(self.cost * 1.15);
LK.getSound('purchase').play();
self.updateDisplay();
@@ -117,13 +117,14 @@
easing: tween.bounceOut
});
// Play sound
LK.getSound('cookieTap').play();
- // Add cookies
- cookies += cookiesPerTap * tapMultiplier;
+ // Add cookies with prestige bonus
+ cookies += cookiesPerTap * tapMultiplier * (1 + prestigeBonus);
updateDisplay();
// Show floating number
- showFloatingNumber('+' + cookiesPerTap * tapMultiplier, self.x, self.y - 50);
+ var earnedCookies = Math.floor(cookiesPerTap * tapMultiplier * (1 + prestigeBonus));
+ showFloatingNumber('+' + earnedCookies, self.x, self.y - 50);
};
self.down = function (x, y, obj) {
self.tap();
};
@@ -152,8 +153,64 @@
}
});
return self;
});
+var PrestigeButton = Container.expand(function () {
+ var self = Container.call(this);
+ var background = self.attachAsset('upgradeButton', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ scaleX: 1.2,
+ scaleY: 0.8
+ });
+ var buttonText = new Text2('ASCEND', {
+ size: 32,
+ fill: 0xFFD700
+ });
+ buttonText.anchor.set(0.5, 0.3);
+ self.addChild(buttonText);
+ self.costText = new Text2('Cost: 100,000', {
+ size: 20,
+ fill: 0xFFFFFF
+ });
+ self.costText.anchor.set(0.5, 0.7);
+ self.addChild(self.costText);
+ self.updateDisplay = function () {
+ var canPrestige = cookies >= 100000 && prestiges < 100;
+ if (canPrestige) {
+ background.tint = 0xFF4500;
+ } else {
+ background.tint = 0x666666;
+ }
+ if (prestiges >= 100) {
+ self.costText.setText('MAX PRESTIGES');
+ } else {
+ self.costText.setText('Cost: 100,000');
+ }
+ };
+ self.prestige = function () {
+ if (cookies >= 100000 && prestiges < 100) {
+ // Reset progress
+ cookies = 0;
+ totalCPS = 0;
+ // Reset all buildings
+ for (var i = 0; i < buildings.length; i++) {
+ buildings[i].count = 0;
+ buildings[i].cost = buildings[i].baseCost;
+ }
+ // Add prestige
+ prestiges++;
+ prestigeBonus = prestiges * 0.1;
+ // Update displays
+ updateDisplay();
+ saveGame();
+ }
+ };
+ self.down = function (x, y, obj) {
+ self.prestige();
+ };
+ return self;
+});
/****
* Initialize Game
****/
@@ -168,8 +225,10 @@
var cookies = storage.cookies || 0;
var totalCPS = storage.totalCPS || 0;
var cookiesPerTap = 1;
var tapMultiplier = 1;
+var prestiges = storage.prestiges || 0;
+var prestigeBonus = prestiges * 0.1; // 10% bonus per prestige
// Buildings data
var buildingsData = [{
type: 'grandma',
cost: 15,
@@ -203,8 +262,21 @@
});
cpsDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(cpsDisplay);
cpsDisplay.y = 120;
+// Create prestige display
+var prestigeDisplay = new Text2('Prestiges: 0 (+0% bonus)', {
+ size: 24,
+ fill: 0x4B0082
+});
+prestigeDisplay.anchor.set(0.5, 0);
+LK.gui.top.addChild(prestigeDisplay);
+prestigeDisplay.y = 160;
+// Create prestige button
+var prestigeButton = new PrestigeButton();
+prestigeButton.x = 1024;
+prestigeButton.y = 2400;
+game.addChild(prestigeButton);
// Create buildings
for (var i = 0; i < buildingsData.length; i++) {
var buildingData = buildingsData[i];
var building = new Building(buildingData.type, buildingData.cost, buildingData.cps);
@@ -214,9 +286,9 @@
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;
+ totalCPS += building.cookiesPerSecond * savedCount * (1 + prestigeBonus);
}
buildings.push(building);
game.addChild(building);
}
@@ -226,8 +298,11 @@
cpsDisplay.setText('Per second: ' + totalCPS);
for (var i = 0; i < buildings.length; i++) {
buildings[i].updateDisplay();
}
+ // Update prestige display
+ prestigeDisplay.setText('Prestiges: ' + prestiges + ' (+' + Math.floor(prestigeBonus * 100) + '% bonus)');
+ prestigeButton.updateDisplay();
}
function showFloatingNumber(text, x, y) {
var floatingNum = new FloatingNumber(text, x, y);
game.addChild(floatingNum);
@@ -235,8 +310,9 @@
}
function saveGame() {
storage.cookies = cookies;
storage.totalCPS = totalCPS;
+ storage.prestiges = prestiges;
for (var i = 0; i < buildings.length; i++) {
storage['building_' + buildings[i].buildingType] = buildings[i].count;
}
}