User prompt
round down all values
User prompt
dont show decimal values
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in this line: 'clickUpgradeButton.priceTag.setText(clickUpgradeButton.clickUpgradePrice.toString());' Line Number: 153
User prompt
do this
Code edit (1 edits merged)
Please save this source code
User prompt
fix it
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Prestige.prestige is not a function' in this line: 'Prestige.prestige();' Line Number: 11
Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'setText')' in this line: 'clickUpgradeButton.priceTag.setText(clickUpgradeButton.clickUpgradePrice.toString());' Line Number: 153
User prompt
after prestige the set the price of click upgrade button to 20
User prompt
after i click the prestige button the item prices need to be reset to the start value
User prompt
after prestige the item prices need to be resetet to the default value
User prompt
change the prestige value from 2 to 1.1
Code edit (1 edits merged)
Please save this source code
User prompt
position the prestige button below the muffin container
User prompt
when i click prestige button the prestige points counter changes its postion. fix it to its position
User prompt
dont round the increase of the prestige points
User prompt
increase the prestige points by 1% of the score display
Code edit (1 edits merged)
Please save this source code
User prompt
the prestige system also should soft reset the cost of the upgrades
User prompt
create a button to active the prestige and reset the score display
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
center the prestige display below the scroe display
/**** * Classes ****/ // Auto Click Upgrade Button class to represent the button for upgrading auto clicks var AutoClickUpgradeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('autoClickUpgradeButton', 'Upgrade button for auto click', 0.5, 0.5); this.autoClickUpgradePrice = 50; // Initial price for auto click upgrade var priceTag = new Text2(this.autoClickUpgradePrice.toString(), { size: 100, fill: "#ffffff" }); priceTag.anchor.set(0.5, 0); priceTag.y = -buttonGraphics.height / 2 - 20; self.addChild(priceTag); self.interactive = true; // Make the button clickable // Function to handle the click on the button self.click = function () { if (score >= this.autoClickUpgradePrice) { // Check if the player has enough score to purchase the upgrade score -= this.autoClickUpgradePrice; // Deduct the cost of the upgrade this.autoClickUpgradePrice *= 2; // Double the price for the next upgrade autoClickValue += 1; // Increase the auto click value scoreDisplay.updateScore(score); // Update the score display priceTag.setText(this.autoClickUpgradePrice.toString()); // Update the price display // Start auto clicker if not already started and there is at least one auto click if (autoClickValue > 0 && !game.autoClicker) { game.autoClicker = LK.setInterval(function () { game.incrementScore(autoClickValue); }, 1000); } } }; // Add event listener for clicks/taps self.on('down', function () { self.click(); }); }); // Click Upgrade Button class to represent the button for upgrading click value var ClickUpgradeButton = Container.expand(function () { var self = Container.call(this); var buttonGraphics = self.createAsset('clickUpgradeButton', 'Upgrade button for +1 click', 0.5, 0.5); this.clickUpgradePrice = 20; // Initial price for click upgrade var priceTag = new Text2(this.clickUpgradePrice.toString(), { size: 100, fill: "#ffffff" }); priceTag.anchor.set(0.5, 0); priceTag.y = -buttonGraphics.height / 2 - 20; self.addChild(priceTag); self.interactive = true; // Make the button clickable // Function to handle the click on the button self.click = function () { if (score >= this.clickUpgradePrice) { // Check if the player has enough score to purchase the upgrade score -= this.clickUpgradePrice; // Deduct the cost of the upgrade this.clickUpgradePrice *= 2; // Double the price for the next upgrade clickValue += 1; // Increase the click value scoreDisplay.updateScore(score); // Update the score display priceTag.setText(this.clickUpgradePrice.toString()); // Update the price display } }; // Add event listener for clicks/taps self.on('down', function () { self.click(); }); }); // Background class to represent the game background asset var Background = Container.expand(function () { var self = Container.call(this); var backgroundGraphics = self.createAsset('background', 'Game background', 0.5, 0.5); self.width = 2048; // Full width of the game screen self.height = 2732; // Full height of the game screen // Position the background in the center of the screen self.x = 2048 / 2; self.y = 2732 / 2; }); // Muffin class to represent the main clickable muffin var Muffin = Container.expand(function () { var self = Container.call(this); var muffinGraphics = self.createAsset('muffin', 'Main clickable muffin', 0.5, 0.5); self.interactive = true; // Make the muffin clickable // Function to handle the click on the muffin self.click = function () { game.incrementScore(clickValue * Math.pow(2, prestigeSystem.prestigePoints)); var fallingMuffin = new FallingMuffin(); // Set the y position to spawn further down from the top of the screen fallingMuffin.y = -muffinGraphics.height / 2; game.addChild(fallingMuffin); if (!game.fallingMuffins) { game.fallingMuffins = []; } game.fallingMuffins.push(fallingMuffin); }; // Add event listener for clicks/taps self.on('down', function () { self.click(); }); }); // ScoreDisplay class to show the current score var ScoreDisplay = Container.expand(function () { var self = Container.call(this); var scoreText = new Text2('0', { size: 150, fill: "#ffffff" }); scoreText.anchor.set(0.5, 0); // Center the score text self.addChild(scoreText); // Function to update the score display self.updateScore = function (newScore) { scoreText.setText(newScore.toString()); }; }); var Prestige = Container.expand(function () { var self = Container.call(this); self.prestigePoints = 0; var prestigeDisplay = new Text2('Prestige Points: 0', { size: 100, fill: "#ffffff" }); prestigeDisplay.anchor.set(2, 0); prestigeDisplay.y = -100; // Position above the score display self.addChild(prestigeDisplay); // Function to update the prestige display self.updatePrestige = function (points) { self.prestigePoints = points; prestigeDisplay.setText('Prestige Points: ' + points.toString()); }; // Function to handle prestige self.prestige = function () { if (score >= 1000) { // Arbitrary threshold for prestige self.prestigePoints += 1; score = 0; // Reset score clickValue = Math.pow(2, self.prestigePoints); // Double click value for each prestige point scoreDisplay.updateScore(score); // Update the score display self.updatePrestige(self.prestigePoints); // Update the prestige display } }; // Add event listener for prestige self.on('down', function () { self.prestige(); }); }); var FallingMuffin = Container.expand(function () { var self = Container.call(this); var muffinGraphics = self.createAsset('smallMuffin', 'Falling muffin', 0.5, 0.5); self.speed = 5; // Set a random x position when the muffin is created self.x = Math.random() * 2048; // Start above the visible area self.y = -muffinGraphics.height * 2; self.move = function () { self.y += self.speed; self.alpha -= 0.005; if (self.y > 2732) { self.destroy(); } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ var background = game.addChild(new Background()); // Initialize important asset arrays and game variables var score = 0; var clickValue = 1; // Default click value var autoClickValue = 0; // Default auto click value per second game.fallingMuffins = []; var muffin = game.addChild(new Muffin()); var scoreDisplay = LK.gui.top.addChild(new ScoreDisplay()); // Position the muffin in the center of the screen muffin.x = 2048 / 2; muffin.y = 2732 / 2; // Game logic functions game.incrementScore = function (value) { score += value; // Increment the score by the value parameter scoreDisplay.updateScore(score); // Update the score display }; var prestigeSystem = game.addChild(new Prestige()); prestigeSystem.x = 2048 / 2; // Center the prestige display prestigeSystem.y = LK.gui.top.height + scoreDisplay.height + 50; // Position below the score display, accounting for its height LK.gui.top.addChild(prestigeSystem); // Create and position the upgrade buttons var clickUpgradeButton = game.addChild(new ClickUpgradeButton()); clickUpgradeButton.x = 2048 / 3; // Position at bottom center-left and move a little to the left clickUpgradeButton.y = 2732 - clickUpgradeButton.height / 2; // Position at the bottom with half height margin var autoClickUpgradeButton = game.addChild(new AutoClickUpgradeButton()); autoClickUpgradeButton.x = 2048 * (2 / 3); // Position at bottom center-right and move a little to the right autoClickUpgradeButton.y = 2732 - autoClickUpgradeButton.height / 2; // Position at the bottom with half height margin // Main game loop LK.on('tick', function () { // Game logic that needs to be executed every frame for (var i = game.fallingMuffins.length - 1; i >= 0; i--) { game.fallingMuffins[i].move(); if (game.fallingMuffins[i].alpha <= 0) { game.fallingMuffins.splice(i, 1); } } }); // Start the game with the muffin and score display initialized // The score is already initialized to 0, so no need to increment it here.
/****
* Classes
****/
// Auto Click Upgrade Button class to represent the button for upgrading auto clicks
var AutoClickUpgradeButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.createAsset('autoClickUpgradeButton', 'Upgrade button for auto click', 0.5, 0.5);
this.autoClickUpgradePrice = 50; // Initial price for auto click upgrade
var priceTag = new Text2(this.autoClickUpgradePrice.toString(), {
size: 100,
fill: "#ffffff"
});
priceTag.anchor.set(0.5, 0);
priceTag.y = -buttonGraphics.height / 2 - 20;
self.addChild(priceTag);
self.interactive = true; // Make the button clickable
// Function to handle the click on the button
self.click = function () {
if (score >= this.autoClickUpgradePrice) {
// Check if the player has enough score to purchase the upgrade
score -= this.autoClickUpgradePrice; // Deduct the cost of the upgrade
this.autoClickUpgradePrice *= 2; // Double the price for the next upgrade
autoClickValue += 1; // Increase the auto click value
scoreDisplay.updateScore(score); // Update the score display
priceTag.setText(this.autoClickUpgradePrice.toString()); // Update the price display
// Start auto clicker if not already started and there is at least one auto click
if (autoClickValue > 0 && !game.autoClicker) {
game.autoClicker = LK.setInterval(function () {
game.incrementScore(autoClickValue);
}, 1000);
}
}
};
// Add event listener for clicks/taps
self.on('down', function () {
self.click();
});
});
// Click Upgrade Button class to represent the button for upgrading click value
var ClickUpgradeButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.createAsset('clickUpgradeButton', 'Upgrade button for +1 click', 0.5, 0.5);
this.clickUpgradePrice = 20; // Initial price for click upgrade
var priceTag = new Text2(this.clickUpgradePrice.toString(), {
size: 100,
fill: "#ffffff"
});
priceTag.anchor.set(0.5, 0);
priceTag.y = -buttonGraphics.height / 2 - 20;
self.addChild(priceTag);
self.interactive = true; // Make the button clickable
// Function to handle the click on the button
self.click = function () {
if (score >= this.clickUpgradePrice) {
// Check if the player has enough score to purchase the upgrade
score -= this.clickUpgradePrice; // Deduct the cost of the upgrade
this.clickUpgradePrice *= 2; // Double the price for the next upgrade
clickValue += 1; // Increase the click value
scoreDisplay.updateScore(score); // Update the score display
priceTag.setText(this.clickUpgradePrice.toString()); // Update the price display
}
};
// Add event listener for clicks/taps
self.on('down', function () {
self.click();
});
});
// Background class to represent the game background asset
var Background = Container.expand(function () {
var self = Container.call(this);
var backgroundGraphics = self.createAsset('background', 'Game background', 0.5, 0.5);
self.width = 2048; // Full width of the game screen
self.height = 2732; // Full height of the game screen
// Position the background in the center of the screen
self.x = 2048 / 2;
self.y = 2732 / 2;
});
// Muffin class to represent the main clickable muffin
var Muffin = Container.expand(function () {
var self = Container.call(this);
var muffinGraphics = self.createAsset('muffin', 'Main clickable muffin', 0.5, 0.5);
self.interactive = true; // Make the muffin clickable
// Function to handle the click on the muffin
self.click = function () {
game.incrementScore(clickValue * Math.pow(2, prestigeSystem.prestigePoints));
var fallingMuffin = new FallingMuffin();
// Set the y position to spawn further down from the top of the screen
fallingMuffin.y = -muffinGraphics.height / 2;
game.addChild(fallingMuffin);
if (!game.fallingMuffins) {
game.fallingMuffins = [];
}
game.fallingMuffins.push(fallingMuffin);
};
// Add event listener for clicks/taps
self.on('down', function () {
self.click();
});
});
// ScoreDisplay class to show the current score
var ScoreDisplay = Container.expand(function () {
var self = Container.call(this);
var scoreText = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreText.anchor.set(0.5, 0); // Center the score text
self.addChild(scoreText);
// Function to update the score display
self.updateScore = function (newScore) {
scoreText.setText(newScore.toString());
};
});
var Prestige = Container.expand(function () {
var self = Container.call(this);
self.prestigePoints = 0;
var prestigeDisplay = new Text2('Prestige Points: 0', {
size: 100,
fill: "#ffffff"
});
prestigeDisplay.anchor.set(2, 0);
prestigeDisplay.y = -100; // Position above the score display
self.addChild(prestigeDisplay);
// Function to update the prestige display
self.updatePrestige = function (points) {
self.prestigePoints = points;
prestigeDisplay.setText('Prestige Points: ' + points.toString());
};
// Function to handle prestige
self.prestige = function () {
if (score >= 1000) {
// Arbitrary threshold for prestige
self.prestigePoints += 1;
score = 0; // Reset score
clickValue = Math.pow(2, self.prestigePoints); // Double click value for each prestige point
scoreDisplay.updateScore(score); // Update the score display
self.updatePrestige(self.prestigePoints); // Update the prestige display
}
};
// Add event listener for prestige
self.on('down', function () {
self.prestige();
});
});
var FallingMuffin = Container.expand(function () {
var self = Container.call(this);
var muffinGraphics = self.createAsset('smallMuffin', 'Falling muffin', 0.5, 0.5);
self.speed = 5;
// Set a random x position when the muffin is created
self.x = Math.random() * 2048;
// Start above the visible area
self.y = -muffinGraphics.height * 2;
self.move = function () {
self.y += self.speed;
self.alpha -= 0.005;
if (self.y > 2732) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
var background = game.addChild(new Background());
// Initialize important asset arrays and game variables
var score = 0;
var clickValue = 1; // Default click value
var autoClickValue = 0; // Default auto click value per second
game.fallingMuffins = [];
var muffin = game.addChild(new Muffin());
var scoreDisplay = LK.gui.top.addChild(new ScoreDisplay());
// Position the muffin in the center of the screen
muffin.x = 2048 / 2;
muffin.y = 2732 / 2;
// Game logic functions
game.incrementScore = function (value) {
score += value; // Increment the score by the value parameter
scoreDisplay.updateScore(score); // Update the score display
};
var prestigeSystem = game.addChild(new Prestige());
prestigeSystem.x = 2048 / 2; // Center the prestige display
prestigeSystem.y = LK.gui.top.height + scoreDisplay.height + 50; // Position below the score display, accounting for its height
LK.gui.top.addChild(prestigeSystem);
// Create and position the upgrade buttons
var clickUpgradeButton = game.addChild(new ClickUpgradeButton());
clickUpgradeButton.x = 2048 / 3; // Position at bottom center-left and move a little to the left
clickUpgradeButton.y = 2732 - clickUpgradeButton.height / 2; // Position at the bottom with half height margin
var autoClickUpgradeButton = game.addChild(new AutoClickUpgradeButton());
autoClickUpgradeButton.x = 2048 * (2 / 3); // Position at bottom center-right and move a little to the right
autoClickUpgradeButton.y = 2732 - autoClickUpgradeButton.height / 2; // Position at the bottom with half height margin
// Main game loop
LK.on('tick', function () {
// Game logic that needs to be executed every frame
for (var i = game.fallingMuffins.length - 1; i >= 0; i--) {
game.fallingMuffins[i].move();
if (game.fallingMuffins[i].alpha <= 0) {
game.fallingMuffins.splice(i, 1);
}
}
});
// Start the game with the muffin and score display initialized
// The score is already initialized to 0, so no need to increment it here.
Imple 2d Muffin, flat. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cute simple 2d Muffin bakery shop from inside. 2d. High contrast. No shadows. Clicker background asset, Flat, few details, few colors
Glitter on muffin
create a muffin with a rocket. muffin goes to the moon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Create a Button with a Diagramm consiting of 4 Bars in the Background and a Muffin in the forthground. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Stop watch with a big +1 sign. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Simple round start Button with big Play/start Symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.