User prompt
make box3 next to megaUpgradeButton
User prompt
make a box2 next to the UpgradeButton
User prompt
make a box 2 next to upgradeButton
User prompt
make a box next to upgradeButton
User prompt
move the box a little longer away from the upgrade
User prompt
write next to the upgrade 50$ 1+click
User prompt
make prices for the different buttons
User prompt
make megaUpgradeButton lower down
User prompt
make another Upgrade button for 10000 that gives 20* clicking
User prompt
make upgradeButton cost 200$ and give 5* clicking
User prompt
make a upgrade button below the upgrade
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'anchor')' in this line: 'self.anchor.set(anchorX, anchorY);' Line Number: 54
User prompt
make a text
User prompt
make a box next to the upgrade
User prompt
make a text below the upgrade saying´ ketchup 50$ 2x click´
User prompt
make a upgrade option in the top right corner for 50$
Initial prompt
pizza clicker
===================================================================
--- original.js
+++ change.js
@@ -28,8 +28,27 @@
self.update = function () {
// Add any updates per frame here if needed
};
});
+// UpgradeButton class
+var UpgradeButton = Container.expand(function () {
+ var self = Container.call(this);
+ var upgradeButtonGraphics = self.createAsset('upgradeButton', 'Upgrade button', 0.5, 0.5);
+ self.cost = 100; // Cost of the new upgrade button
+ self.onClick = function () {
+ if (LK.getScore() >= self.cost) {
+ // Deduct cost and increase pizza value more significantly
+ LK.setScore(LK.getScore() - self.cost);
+ pizza.value += 5;
+ // Update score text
+ scoreTxt.setText("$" + LK.getScore());
+ // Add a visual effect or animation if needed
+ }
+ };
+ self.update = function () {
+ // Add any updates per frame here if needed
+ };
+});
// Pizza class
var Pizza = Container.expand(function () {
var self = Container.call(this);
var pizzaGraphics = self.createAsset('pizza', 'Clickable pizza', 0.5, 0.5);
@@ -44,34 +63,12 @@
self.update = function () {
// Add any updates per frame here if needed
};
});
-// ScoreText class
-var ScoreText = Text2.expand(function (initialText, size, color, anchorX, anchorY) {
- var self = Text2.call(this, initialText, {
- size: size,
- fill: color
- });
- self.style.anchor.set(anchorX, anchorY);
- return self;
-});
-// Create score text instance
-// KetchupUpgradeText class
-var KetchupUpgradeText = Text2.expand(function (text, size, color, anchorX, anchorY, posX, posY) {
- var self = Text2.call(this, text, {
- size: size,
- fill: color
- });
- self.anchor.set(anchorX, anchorY);
- self.x = posX;
- self.y = posY;
- return self;
-});
/****
* Initialize Game
****/
-// Create ketchup upgrade text instance
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
@@ -80,12 +77,24 @@
****/
var upgrade = game.addChild(new Upgrade());
upgrade.x = 2048 - upgrade.width / 2;
upgrade.y = upgrade.height / 2;
-// Create score text instance
-var scoreTxt = LK.gui.top.addChild(new ScoreText('$0', 150, "#ffffff", 0.5, 0));
-// Create ketchup upgrade text instance
-var ketchupUpgradeTxt = LK.gui.bottom.addChild(new KetchupUpgradeText('ketchup 50$ 2x click', 100, "#ffffff", 0.5, 0, upgrade.x, upgrade.y + upgrade.height / 2 + 20));
+// Score text
+var scoreTxt = new Text2('$0', {
+ size: 150,
+ fill: "#ffffff"
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// Ketchup upgrade text
+var ketchupUpgradeTxt = new Text2('ketchup 50$ 2x click', {
+ size: 100,
+ fill: "#ffffff"
+});
+ketchupUpgradeTxt.anchor.set(0.5, 0);
+ketchupUpgradeTxt.x = upgrade.x;
+ketchupUpgradeTxt.y = upgrade.y + upgrade.height / 2 + 20;
+LK.gui.bottom.addChild(ketchupUpgradeTxt);
// Create pizza in the center of the screen
var pizza = game.addChild(new Pizza());
pizza.x = 2048 / 2;
pizza.y = 2732 / 2;
@@ -98,9 +107,20 @@
pizza.onClick();
}); // Event listener for clicking the upgrade option
upgrade.on('down', function (obj) {
upgrade.onClick();
+}); // Event listener for clicking the upgrade option
+upgrade.on('down', function (obj) {
+ upgrade.onClick();
});
+// Create and position the new upgrade button
+var upgradeButton = game.addChild(new UpgradeButton());
+upgradeButton.x = upgrade.x;
+upgradeButton.y = upgrade.y + upgrade.height + 20;
+// Event listener for clicking the new upgrade button
+upgradeButton.on('down', function (obj) {
+ upgradeButton.onClick();
+});
// Main game tick event
LK.on('tick', function () {
// Update the pizza and upgrade each frame
pizza.update();
hotdog with no mustard no ketchup only bread and dog. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
make a ketchup bottle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
yellow mustard. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pickles. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
write 50$ on a sign. no shadow, 2D
write 200$ on a sign. no shadow, 2D
write 10000$ on a sign. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.