Code edit (8 edits merged)
Please save this source code
User prompt
staggered grid, should have more higher hp block than lowe ones
User prompt
remove offset for staggered grid
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -103,12 +103,43 @@
fill: 0x000000
});
self.healthText.anchor.set(0.5, 0.5);
self.addChild(self.healthText);
+ // Helper function to convert hex color to RGB
+ function hexToRGB(hex) {
+ return {
+ r: hex >> 16 & 0xff,
+ g: hex >> 8 & 0xff,
+ b: hex & 0xff
+ };
+ }
+ // Helper function to convert RGB back to hex
+ function rgbToHex(r, g, b) {
+ return (Math.floor(r) << 16) + (Math.floor(g) << 8) + Math.floor(b);
+ }
+ // Update brick tint based on health
self.updateTint = function () {
- var healthPercent = self.health / self.maxHealth;
- var colorIndex = Math.min(Math.floor((1 - healthPercent) * LEVEL_COLORS.length), LEVEL_COLORS.length - 1);
- brickGraphics.tint = LEVEL_COLORS[colorIndex];
+ var baseColors = LEVEL_COLORS;
+ var colorCount = baseColors.length;
+ if (self.health <= colorCount) {
+ // For HP <= number of colors, use the direct mapping
+ brickGraphics.tint = baseColors[self.health - 1];
+ } else {
+ // For higher HP, generate a tone variation
+ var baseIndex = (self.health - 1) % colorCount; // Cycle through base colors
+ var baseColor = hexToRGB(baseColors[baseIndex]);
+ var factor = Math.floor((self.health - 1) / colorCount); // How many cycles past base colors
+ // Adjust brightness (darken progressively with higher HP)
+ var darkenFactor = Math.max(0, 1 - factor * 0.1); // Reduce by 10% per cycle, clamp at 0
+ var r = baseColor.r * darkenFactor;
+ var g = baseColor.g * darkenFactor;
+ var b = baseColor.b * darkenFactor;
+ // Ensure values stay within valid range (0-255)
+ r = Math.max(0, Math.min(255, r));
+ g = Math.max(0, Math.min(255, g));
+ b = Math.max(0, Math.min(255, b));
+ brickGraphics.tint = rgbToHex(r, g, b);
+ }
};
self.updateTint();
self.hit = function () {
var damage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;