User prompt
delete 'pizzaSound'
User prompt
apply the sound 'pizza' to the pizza button, so every time you click it, it makes that sound
User prompt
make a pizza sound
User prompt
it doesnt make a sound
User prompt
make a pizza sound when you click the pizza
User prompt
make the reset game button restart the game or make you lose
User prompt
make an error sound every time you click a button but you dont have enough money to buy the upgrade
User prompt
make a button click sound every time you click the pizza or an upgrade button
User prompt
Migrate to the latest version of LK
User prompt
the screen is stuck on frvr loading
User prompt
make the counter show $ instead of just points
User prompt
make a sound everytime a player clicks the piza
User prompt
make an animation for the pizza when clicking it, to simulate a button effect
User prompt
when you hit the auto clicker button, it starts clicking the 'pizza' for you, with one click per second, increasing more if you buy more of the auto clicker upgrades
User prompt
make some distance between both upgrade buttons
User prompt
move the upgrade 200px to the left
User prompt
move the upgrade button 100px to the left
User prompt
move the auto clicker a bit to the right
User prompt
make a button beside the upgrade button for an auto clicker upgrade
User prompt
position the reset button 100px lower
User prompt
position the reset button at the top right corner
User prompt
make a button to reset the entire game
User prompt
make upgrades that you can use your score on to get more score pr click
User prompt
fix animation
User prompt
make an animation for pizza, to simulate a button press
===================================================================
--- original.js
+++ change.js
@@ -1,7 +1,40 @@
/****
* Classes
-****/
+****/
+// AutoClicker class
+var AutoClicker = Container.expand(function () {
+ var self = Container.call(this);
+ self.startAutoClicking = function () {
+ LK.setInterval(function () {
+ if (self.autoClickerCount > 0) {
+ pizza.onClick(); // Simulate a pizza click
+ }
+ }, 1000 / self.autoClickerCount); // Click once per second per auto clicker
+ };
+ var autoClickerGraphics = self.attachAsset('autoClicker', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.cost = 100; // Initial cost of the auto clicker
+ self.autoClickerCount = 0;
+ self.onClick = function () {
+ if (currentScore >= self.cost) {
+ currentScore -= self.cost; // Deduct the cost from the current score
+ score.updateScore(currentScore); // Update the score display
+ self.autoClickerCount += 1; // Increase the number of auto clickers
+ self.startAutoClicking(); // Start auto clicking
+ self.cost *= 3; // Triple the cost for the next auto clicker
+ autoClickerText.setText('Auto Clicker: $' + self.cost); // Update the auto clicker text
+ }
+ };
+ var autoClickerText = new Text2('Auto Clicker: $' + self.cost, {
+ size: 100,
+ fill: "#ffffff"
+ });
+ autoClickerText.anchor.set(0.5, 0);
+ self.addChild(autoClickerText);
+});
// Pizza class
var Pizza = Container.expand(function () {
var self = Container.call(this);
var pizzaGraphics = self.attachAsset('pizza', {
@@ -32,21 +65,8 @@
// Start the scale animation
LK.on('tick', animateScale);
};
});
-// Score class
-var Score = Container.expand(function () {
- var self = Container.call(this);
- var scoreText = new Text2('0', {
- size: 150,
- fill: "#ffffff"
- });
- scoreText.anchor.set(0.5, 0);
- self.addChild(scoreText);
- self.updateScore = function (newScore) {
- scoreText.setText('$' + newScore.toString());
- };
-});
// ResetButton class
var ResetButton = Container.expand(function () {
var self = Container.call(this);
var resetButtonGraphics = self.attachAsset('resetButton', {
@@ -60,8 +80,21 @@
resetButtonText.anchor.set(0.5, 0);
self.addChild(resetButtonText);
self.on('down', function () {});
});
+// Score class
+var Score = Container.expand(function () {
+ var self = Container.call(this);
+ var scoreText = new Text2('0', {
+ size: 150,
+ fill: "#ffffff"
+ });
+ scoreText.anchor.set(0.5, 0);
+ self.addChild(scoreText);
+ self.updateScore = function (newScore) {
+ scoreText.setText('$' + newScore.toString());
+ };
+});
// Upgrade class
var Upgrade = Container.expand(function () {
var self = Container.call(this);
var upgradeGraphics = self.attachAsset('upgrade', {
@@ -94,52 +127,19 @@
self.updateUpgradeText(); // Update the upgrade text
}
};
});
-// AutoClicker class
-var AutoClicker = Container.expand(function () {
- var self = Container.call(this);
- self.startAutoClicking = function () {
- LK.setInterval(function () {
- if (self.autoClickerCount > 0) {
- pizza.onClick(); // Simulate a pizza click
- }
- }, 1000 / self.autoClickerCount); // Click once per second per auto clicker
- };
- var autoClickerGraphics = self.attachAsset('autoClicker', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.cost = 100; // Initial cost of the auto clicker
- self.autoClickerCount = 0;
- self.onClick = function () {
- if (currentScore >= self.cost) {
- currentScore -= self.cost; // Deduct the cost from the current score
- score.updateScore(currentScore); // Update the score display
- self.autoClickerCount += 1; // Increase the number of auto clickers
- self.startAutoClicking(); // Start auto clicking
- self.cost *= 3; // Triple the cost for the next auto clicker
- autoClickerText.setText('Auto Clicker: $' + self.cost); // Update the auto clicker text
- }
- };
- var autoClickerText = new Text2('Auto Clicker: $' + self.cost, {
- size: 100,
- fill: "#ffffff"
- });
- autoClickerText.anchor.set(0.5, 0);
- self.addChild(autoClickerText);
-});
/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
-****/
+****/
// Initialize pizza
var pizza = game.addChild(new Pizza());
pizza.x = 2048 / 2;
pizza.y = 2732 / 2;
@@ -161,20 +161,20 @@
var autoClicker = game.addChild(new AutoClicker());
autoClicker.x = upgrade.x + upgrade.width + 200; // Position auto clicker button with increased distance to the right of the upgrade button
autoClicker.y = upgrade.y;
// Add event listener for auto clicker clicks
-autoClicker.on('down', function (obj) {
+autoClicker.on('down', function (x, y, obj) {
autoClicker.onClick();
});
// Add event listener for upgrade clicks
// Initialize reset button
var resetButton = game.addChild(new ResetButton());
resetButton.x = 2048 - resetButton.width / 2;
resetButton.y = resetButton.height / 2 + 100; // Position reset button at the top right corner
-upgrade.on('down', function (obj) {
+upgrade.on('down', function (x, y, obj) {
upgrade.onClick();
});
-pizza.on('down', function (obj) {
+pizza.on('down', function (x, y, obj) {
pizza.onClick();
});
// Main game tick event
LK.on('tick', function () {
a pepperoni pizza. In-Game asset. 2d. Blank background. High contrast.
a button saying 'upgrade'. In-Game asset. 2d. Blank background. High contrast.
a button saying 'reset'. In-Game asset. 2d. Blank background. High contrast.
a button saying 'autoclicker'. In-Game asset. 2d. Blank background. High contrast.