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 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
cookies += cookiesPerTap * tapMultiplier;
updateDisplay();
// Show floating number
showFloatingNumber('+' + cookiesPerTap * tapMultiplier, 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;
});
/****
* 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;
// 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 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;
}
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();
}
}
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;
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
@@ -1,6 +1,263 @@
-/****
+/****
+* 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 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
+ cookies += cookiesPerTap * tapMultiplier;
+ updateDisplay();
+ // Show floating number
+ showFloatingNumber('+' + cookiesPerTap * tapMultiplier, 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;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var cookies = storage.cookies || 0;
+var totalCPS = storage.totalCPS || 0;
+var cookiesPerTap = 1;
+var tapMultiplier = 1;
+// 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 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;
+ }
+ 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();
+ }
+}
+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;
+ 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);
+ }
+ }
+};
\ No newline at end of file