Code edit (6 edits merged)
Please save this source code
User prompt
also update the actual cost of sniper to 500
User prompt
on reset also deletet ulocked tiers for ball typer
Code edit (1 edits merged)
Please save this source code
User prompt
when splash ball hits a brick, bricks that also take damage shoudl blink
User prompt
only rename scatter name on button to Multi
User prompt
Please fix the bug: 'Uncaught TypeError: storage.balls.forEach is not a function' in or related to this line: 'storage.balls.forEach(function (ballData) {' Line Number: 1021 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
balls are not being loaded
User prompt
Balls quantity should be stored per ball type. So better create 4 ball storeages, one for each type.
User prompt
on reset reset the balls too
User prompt
disregard the balls positions in storage, only the type and the quantity. then they can spawn anywhere in the screen ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
store the ball and the ball type in storage. so store them as individual things, not all together
User prompt
Also make sure to store the type of ball not only the quanitty
User prompt
Make sure to correclty store the ball type
User prompt
for storing balls, just stor the quantity of those that have been bought, when the game retarst they can spawn from any position in the screen
User prompt
storage balls is still failing...can you try a different approach?
User prompt
Why are the balls not saved in storage
User prompt
add a splash animation to the spash ball ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
close powerups display when a brick is clicked
User prompt
How can I do for ballicons not to inherit the color of the button their are int
User prompt
ballicon shouldnot be a child of the button
User prompt
reset the ballicon color after it is added to the button
Code edit (4 edits merged)
Please save this source code
User prompt
do not use LK.getAsset
User prompt
buttons should use the ball icon color of their ball color
===================================================================
--- original.js
+++ change.js
@@ -415,8 +415,9 @@
splash: false,
sniper: false,
scatter: false
};
+ unlockedTiers = Object.assign({}, storage.unlockedTiers);
storage.upgrades = {
normalSpeed: 1,
normalPower: 1,
splashSpeed: 1,
@@ -476,29 +477,29 @@
button.y = 50;
button.x = x + 20;
var contentContainer = new Container();
button.addChild(contentContainer);
- // Set the ballIcon tint based on the ball type, matching the Ball class
var ballIcon = button.attachAsset('ball', {
anchorX: 0.5,
anchorY: -0.5,
scaleX: 0.6,
scaleY: 0.6,
- y: -10,
- tint: type === 'splash' ? 0xff0066 : type === 'sniper' ? 0x00ff99 : type === 'scatter' ? 0xffff00 : 0xffffff // Default to white for 'normal'
+ y: -10
});
+ // Set initial tint
+ ballIcon.tint = type === 'splash' ? 0xff0066 : type === 'sniper' ? 0x00ff99 : type === 'scatter' ? 0xffff00 : 0xffffff; // Normal ball
contentContainer.addChild(ballIcon);
var displayType = type === 'scatter' ? 'Multi' : type.charAt(0).toUpperCase() + type.slice(1);
var typeText = new Text2(displayType, {
size: 30,
- fill: 0xffffff
+ fill: 0xffffff // Initial white color
});
typeText.anchor.set(0.5, 0);
typeText.y = -50;
button.addChild(typeText);
var costText = new Text2('$' + (type === 'sniper' ? 500 : type === 'splash' ? 150 : type === 'scatter' ? 2000 : upgrades[type + 'BallCost']), {
size: 50,
- fill: 0x00ffff
+ fill: 0x00ffff // Initial cyan color
});
costText.anchor.set(0.5, 0);
costText.y = 100;
button.addChild(costText);
@@ -520,10 +521,20 @@
}
};
button.updateState = function () {
var isEnabled = (prevTier ? unlockedTiers[prevTier] : true) && score >= upgrades[type + 'BallCost'];
- button.tint = isEnabled ? 0x00ffff : 0x666666; // This tint applies to the button, not the ballIcon
+ buttonGraphics.tint = isEnabled ? 0x00ffff : 0x666666; // Button background tint
button.interactive = isEnabled;
+ // Update ballIcon tint based on enabled state
+ if (isEnabled) {
+ ballIcon.tint = type === 'splash' ? 0xff0066 : type === 'sniper' ? 0x00ff99 : type === 'scatter' ? 0xffff00 : 0xffffff; // Restore original ball color
+ typeText.fill = 0xffffff; // White for ball name
+ costText.fill = 0x00ffff; // Cyan for price
+ } else {
+ ballIcon.tint = 0x666666; // Grey out ball icon
+ typeText.fill = 0x666666; // Grey out ball name
+ costText.fill = 0x666666; // Grey out price
+ }
};
hud.addChild(button);
ballButtons[type] = button;
}
@@ -567,16 +578,17 @@
button.y = 350;
button.addChild(buttonGraphics);
var contentContainer = new Container();
button.addChild(contentContainer);
+ var icon = null;
if (iconType) {
- var icon = button.attachAsset('ball', {
+ icon = button.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5,
y: 40,
- tint: iconType === 'splashBall' ? 0xff0066 : iconType === 'sniperBall' ? 0x00ff99 : iconType === 'scatterBall' ? 0xffff00 : 0x00ffff
+ tint: iconType === 'splashBall' ? 0xff0066 : iconType === 'sniperBall' ? 0x00ff99 : iconType === 'scatterBall' ? 0xffff00 : iconType === 'ball' ? 0xffffff : 0x00ffff // Fallback
});
contentContainer.addChild(icon);
}
var labelText = new Text2("".concat(labelPrefix, " x").concat(upgrades[upgradeKey]), {
@@ -631,10 +643,20 @@
};
button.updateState = function () {
var ballType = upgradeKey.split('Speed')[0].split('Power')[0];
var isEnabled = upgradeKey === 'clickDamage' ? score >= baseCost * upgrades[upgradeKey] : unlockedTiers[ballType] && (prevTier ? unlockedTiers[prevTier] : true) && score >= baseCost * upgrades[upgradeKey];
- button.tint = isEnabled ? 0x00ffff : 0x666666;
+ buttonGraphics.tint = isEnabled ? 0x00ffff : 0x666666; // Button background tint
button.interactive = isEnabled;
+ // Update icon tint based on enabled state
+ if (icon) {
+ if (isEnabled) {
+ // Restore original ball color when enabled
+ icon.tint = iconType === 'splashBall' ? 0xff0066 : iconType === 'sniperBall' ? 0x00ff99 : iconType === 'scatterBall' ? 0xffff00 : iconType === 'ball' ? 0xffffff : 0x00ffff;
+ } else {
+ // Grey out when disabled
+ icon.tint = 0x666666;
+ }
+ }
};
powerupContainer.addChild(button);
upgradeButtons[upgradeKey] = button;
}