User prompt
Cool but i found a glitch where when u click the button when the game starts, the circleglow asset applears even if it hasnt been purchased
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'if (circleglowOverlay) {' Line Number: 225
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(circleglowOverlay, {' Line Number: 225 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Found a glitch for when the circleglow asset is selected and is in front of the button when you click it the animation plays for the old button, it should play for the circleglow asset
User prompt
Now make it so when circleglow asset is bought the circleglow asset is put in front of the original button
User prompt
Found a glitch where when you close the shop the circleglow asset is still visible please fix it
User prompt
Now make another button exactly like the greenglowy asset in the shop gut put it next to the greenglowy asset and instead of it being the greenglowy asset make it the circleasset
User prompt
Now make it so when greenglowyvalue = 1 and you tap on the greenglowy asset in the shop it will not take 20$ anymore
User prompt
Noe make it so the green glow text in the shop, whenever the greenglowyvalue = 0 it will say green glowy 20$. When the greenglowyvalue = 1 it will say owned
User prompt
Ok lets make a variable instead name the variable greenglowyvalue, at the start of the game make the greenglowyvalue equal to 0 and whenever the greenglowy asset in the shop is bought make the greenglowyvalue equal to 1
User prompt
At thestart of the game make the text say green glow 20$ make it say owned when its owned including when you re open the shop
User prompt
Have it say green glowy 20$ at the start of the game, when you buy it make it say owned and make sure when the shop is closed and re opended it should still say owned
User prompt
BRO! AT THE START OF THE GAME MAKE IT SAY GREEN GLOWY 20$ WHEN AND ONLY WHEN IT IS BOUGHT MAKE IT SAY OWNED
User prompt
Ok close because now when you buy it, exit the the shop and re enter it says green glowy 20$ it should say owned
User prompt
When the game is first started make the text under the greenglowy make it say green glowy 20$, when you buy it make it say owned
User prompt
So when the greenglowy has not been purchased the text should say green glowy 20$
User prompt
Found a glitch where even if the greenglow asset isnt bought the text says owned. It should only say owned if it has been purchased
User prompt
Found a glitch where when you close the shop and open it again the text says greenglow: 20 fix that
User prompt
Make it so when you buy the greenglow asset from the shop the greenglow text below it says "Owned"
User prompt
Make it so when you buy out all the worker upgrades make a text pop up in that same position saying Worker max: 10/s
User prompt
Ok good, but when you buy the +150 worker the +50 worker text appears fix that please
User prompt
When you buy the +150 workervalue completly delete the worker button and all the worker texts
User prompt
When you buy all the workers they restart back at 20, make so it does not do that anymore please.
User prompt
Found a glitch where when you buy all the worker upgraded if you click there it still buys it fix that
User prompt
Found a glitch where when you buy all the worker upgrades the text is still left there, delete the text too
/****
* Plugins
****/
var storage = LK.import("@upit/storage.v1", {
points: 0,
upgrades: {
workerValue: 0
},
unlockedSkins: []
});
var tween = LK.import("@upit/tween.v1");
/****
* Initialize Game
****/
//<Write entity 'classes' with empty functions for important behavior here>
var game = new LK.Game({
backgroundColor: 0xFFFFFF //Init game with white background
});
/****
* Game Code
****/
//<Write imports for supported plugins here>
//<Assets used in the game will automatically appear here>
function openShopMenu() {
// Logic to display the shop menu
console.log("Shop menu is now open.");
// Create a large shop menu
var shopMenu = LK.getAsset('Shop', {
width: 1600,
// Increase width
height: 1600,
// Increase height to make it taller
x: 2048 / 2 - 800,
// Center horizontally
y: 2732 / 2 - 800
// Center vertically
});
game.addChild(shopMenu);
// Add greenglow asset purchase option
var greenglowButton = LK.getAsset('Greenglowy', {
width: 400,
height: 400,
x: shopMenu.x + 100,
y: shopMenu.y + 100
});
game.addChild(greenglowButton);
var greenglowButtonText = new Text2(greenglowyvalue === 1 ? 'Owned' : '20$ Greenglow', {
size: 70,
fill: 0x000000
});
greenglowButtonText.x = greenglowButton.x + greenglowButton.width / 2 - greenglowButtonText.width / 2;
greenglowButtonText.y = greenglowButton.y + greenglowButton.height / 2 - greenglowButtonText.height / 2 + 250;
game.addChild(greenglowButtonText);
// Add circle asset purchase option
var circleButton = LK.getAsset('Circleglow', {
width: 400,
height: 400,
x: shopMenu.x + 600,
// Position next to greenglowButton
y: shopMenu.y + 100
});
game.addChild(circleButton);
var circleButtonText = new Text2(circlevalue === 1 ? 'Owned' : '20$ Circle', {
size: 70,
fill: 0x000000
});
circleButtonText.x = circleButton.x + circleButton.width / 2 - circleButtonText.width / 2;
circleButtonText.y = circleButton.y + circleButton.height / 2 - circleButtonText.height / 2 + 250;
game.addChild(circleButtonText);
greenglowButton.down = function (x, y, obj) {
if (greenglowyvalue === 1) {
console.log("Greenglowy already owned.");
} else if (points >= 20) {
points -= 20;
pointsText.setText('Points: ' + points);
storage.points = points;
storage.unlockedSkins.push('Greenglowy');
greenglowyvalue = 1;
game.removeChild(greenglowButton);
greenglowButtonText.setText('Owned');
storage.unlockedSkins.push('Greenglowy');
storage.unlockedSkins.push('Greenglowy');
// Replace the button asset with the greenglow asset
points++; // Increment points when greenglow button is clicked
pointsText.setText('Points: ' + points); // Update points text
storage.points = points; // Update storage with new points
// Overlay the greenglow asset over the existing button
var greenglowOverlay = LK.getAsset('Greenglowy', {
width: newButton.width,
height: newButton.height,
x: newButton.x,
y: newButton.y
});
game.addChild(greenglowOverlay);
currentButtonSkin = 'Greenglowy';
newButton = LK.getAsset(currentButtonSkin, {
width: 400,
height: 400,
x: 2048 / 2 - 200,
y: 2732 / 2 - 200,
shape: 'circle'
});
game.addChild(newButton);
} else {
console.log("Not enough points to purchase Greenglow.");
}
};
circleButton.down = function (x, y, obj) {
if (circlevalue === 1) {
console.log("Circle already owned.");
} else if (points >= 20) {
points -= 20;
pointsText.setText('Points: ' + points);
storage.points = points;
storage.unlockedSkins.push('Circleglow');
circlevalue = 1;
game.removeChild(circleButton);
circleButtonText.setText('Owned');
// Overlay the Circleglow asset over the existing button
var circleglowOverlay = LK.getAsset('Circleglow', {
width: newButton.width,
height: newButton.height,
x: newButton.x,
y: newButton.y
});
game.addChild(circleglowOverlay);
} else {
console.log("Not enough points to purchase Circle.");
}
};
// Add a close button to the shop menu
var closeButton = LK.getAsset('Close', {
width: 300,
height: 300,
x: shopMenu.x + shopMenu.width - 610,
y: shopMenu.y + 10,
shape: 'box'
});
game.addChild(closeButton);
var closeButtonText = new Text2('Close', {
size: 80,
fill: 0x000000
});
closeButtonText.x = closeButton.x + closeButton.width / 2 - closeButtonText.width / 2;
closeButtonText.y = closeButton.y + closeButton.height / 2 - closeButtonText.height / 2 + 50;
game.addChild(closeButtonText);
closeButton.down = function (x, y, obj) {
game.removeChild(shopMenu);
game.removeChild(closeButton);
game.removeChild(closeButtonText);
game.removeChild(greenglowButton);
game.removeChild(greenglowButtonText);
game.removeChild(circleButton); // Ensure Circleglow is removed when shop is closed
game.removeChild(circleButtonText);
// game.removeChild(shadowglowButton); // Removed as shadowglowButton is not defined
// game.removeChild(shadowglowButtonText); // Removed as shadowglowButtonText is not defined
// Removed glowpack and glowpackText as they are not defined
game.removeChild(LK.getAsset('Gloworange', {})); // Ensure Gloworange is removed when shop is closed
};
}
// Clear the interval when the game is over
game.gameOver = function () {
clearInterval(intervalId);
};
var greenglowyvalue = 0;
var circlevalue = 0; // Initialize circlevalue
var points = storage.points || 0;
var currentButtonSkin = null; // Variable to track the current button skin obtained from the glow pack
var workerValue = storage.upgrades.workerValue || 0;
// Create a text
var pointsText = new Text2('Points: ' + points, {
size: 100,
fill: 0x000000
});
// Position the text on the left hand corner
pointsText.x = 0;
pointsText.y = 0;
// Add the text to the game
game.addChild(pointsText);
var newButton = LK.getAsset(currentButtonSkin || 'Button', {
width: 400,
height: 400,
x: 2048 / 2 - 200,
// Position the new button in the center of the screen
y: 2732 / 2 - 200,
shape: 'circle'
});
// Add the new button to the game
game.addChild(newButton);
// Add a click event to the button
newButton.down = function (x, y, obj) {
// Increase the points
points++;
pointsText.setText('Points: ' + points);
storage.points = points;
if (currentButtonSkin === 'Shadowglowy') {
// Additional logic if needed when shadowglow is active
}
if (LK.getSound('clickSound')) {
LK.getSound('clickSound').play();
} else {
console.error("Click sound not found!");
}
if (circlevalue === 1) {
var circleglowOverlay = LK.getAsset('Circleglow', {
width: newButton.width,
height: newButton.height,
x: newButton.x,
y: newButton.y
});
game.addChild(circleglowOverlay);
}
if (circleglowOverlay) {
tween(circleglowOverlay, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 100,
easing: tween.bounceOut,
onFinish: function onFinish() {
tween(circleglowOverlay, {
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 100,
easing: tween.bounceIn
});
}
});
}
// Update the text
pointsText.setText('Points: ' + points);
storage.points = points;
};
var shopButton = LK.getAsset('Shop', {
width: 400,
height: 200,
x: 2048 - 400,
// Position the button on the bottom right corner
y: 2732 - 200
});
game.addChild(shopButton);
var shopButtonText = new Text2('Shop', {
size: 70,
fill: 0x000000
});
shopButtonText.x = shopButton.x + shopButton.width / 2 - shopButtonText.width / 2;
shopButtonText.y = shopButton.y + shopButton.height / 2 - shopButtonText.height / 2;
game.addChild(shopButtonText);
shopButton.down = function (x, y, obj) {
// Logic to open the shop menu
openShopMenu();
};
// Add an inventory button to the bottom left corner
;
var intervalId;
var button = LK.getAsset('Shop', {
width: 600,
height: 300,
x: 1448,
// Position the button on the right hand corner
y: 0
});
// Add the button to the game
game.addChild(button);
// Add a click event to the button
button.down = function (x, y, obj) {
// Check if the points are 20 or more
if (points >= 20) {
// Decrease the points
points -= 20;
// Update the text
pointsText.setText('Points: ' + points);
storage.points = points;
// Update workerValue to 1
workerValue = 1;
storage.upgrades.workerValue = workerValue;
storage.upgrades = {
workerValue: workerValue
};
// Start getting workerValue points every second
intervalId = LK.setInterval(function () {
points += workerValue;
// Update the text
pointsText.setText('Points: ' + points);
}, 1000);
// Remove the old button and its text
button.alpha = 0; // Make the original button invisible instead of removing it
game.removeChild(buttonText); // Remove the old text
// Create a new button with different text
var newButton = LK.getAsset('Shop', {
width: 600,
height: 300,
x: 1448,
y: 0
});
// Add the new button to the game
game.addChild(newButton);
// Create a new text
var newText = new Text2('50$ +5 worker', {
size: 100,
fill: 0x000000
});
// Position the text on the new button
newText.x = newButton.x + newButton.width / 2 - newText.width / 2;
newText.y = newButton.y + newButton.height / 2 - newText.height / 2;
// Add the text to the game
game.addChild(newText);
// Add a click event to the new button
newButton.down = function (x, y, obj) {
// Check if the points are 50 or more
if (points >= 50) {
// Decrease the points
points -= 50;
// Update the text
pointsText.setText('Points: ' + points);
storage.points = points;
// Update workerValue to 5
workerValue = 5;
storage.upgrades.workerValue = workerValue;
storage.upgrades = {
workerValue: workerValue
};
// Clear the previous interval
LK.clearInterval(intervalId);
// Start getting workerValue points every second
intervalId = LK.setInterval(function () {
points += workerValue;
// Update the text
pointsText.setText('Points: ' + points);
}, 1000);
// Remove the old button
game.removeChild(newButton);
// Create a new button with different text
var newButton2 = LK.getAsset('Shop', {
width: 600,
height: 300,
x: 1448,
y: 0
});
// Add the new button to the game
game.addChild(newButton2);
// Create a new text
var newText2 = new Text2('150$ +10 worker', {
size: 100,
fill: 0x000000
});
// Position the text on the new button
newText2.x = newButton2.x + newButton2.width / 2 - newText2.width / 2;
newText2.y = newButton2.y + newButton2.height / 2 - newText2.height / 2;
// Add the text to the game
game.addChild(newText2);
// Add a click event to the new button
newButton2.down = function (x, y, obj) {
// Check if the points are 150 or more
if (points >= 150 && workerValue === 5) {
// Decrease the points
points -= 150;
// Update the text
pointsText.setText('Points: ' + points);
storage.points = points;
// Update workerValue to 10
workerValue = 10;
storage.upgrades.workerValue = workerValue;
storage.upgrades = {
workerValue: workerValue
};
// Clear the previous interval
LK.clearInterval(intervalId);
// Start getting workerValue points every second
intervalId = LK.setInterval(function () {
points += workerValue;
// Update the text
pointsText.setText('Points: ' + points);
}, 1000);
// Remove the button and all worker texts after purchasing the upgrade
game.removeChild(newButton2);
game.removeChild(newText2);
game.removeChild(button);
game.removeChild(buttonText);
game.removeChild(newText);
// Display 'Worker max: 10/s' text
var maxWorkerText = new Text2('Worker max: 10/s', {
size: 100,
fill: 0x000000
});
maxWorkerText.x = button.x + button.width / 2 - maxWorkerText.width / 2;
maxWorkerText.y = button.y + button.height / 2 - maxWorkerText.height / 2;
game.addChild(maxWorkerText);
}
};
}
};
}
};
// Create a text
var buttonText = new Text2('20$ +1 worker', {
size: 120,
fill: 0x000000
});
// Position the text on the button
buttonText.x = button.x + button.width / 2 - buttonText.width / 2;
buttonText.y = button.y + button.height / 2 - buttonText.height / 2;
// Add the text to the game
game.addChild(buttonText);
; ===================================================================
--- original.js
+++ change.js
@@ -202,15 +202,17 @@
LK.getSound('clickSound').play();
} else {
console.error("Click sound not found!");
}
- var circleglowOverlay = LK.getAsset('Circleglow', {
- width: newButton.width,
- height: newButton.height,
- x: newButton.x,
- y: newButton.y
- });
- game.addChild(circleglowOverlay);
+ if (circlevalue === 1) {
+ var circleglowOverlay = LK.getAsset('Circleglow', {
+ width: newButton.width,
+ height: newButton.height,
+ x: newButton.x,
+ y: newButton.y
+ });
+ game.addChild(circleglowOverlay);
+ }
if (circleglowOverlay) {
tween(circleglowOverlay, {
scaleX: 1.2,
scaleY: 1.2