Code edit (2 edits merged)
Please save this source code
User prompt
add $ to score when 0
User prompt
ball prices shoudl also increase once one has bought, like it happens with upgrades
User prompt
To address this, you would need to ensure that the cost update logic is applied to the normal ball as well, similar to how it's done for other ball types. This involves adjusting the `upgrades` object and ensuring the cost is recalculated and stored after each purchase.
User prompt
can you add 5 more levels
Code edit (1 edits merged)
Please save this source code
User prompt
cost of balls should increase in 30% after every purchase
User prompt
upgrade buttons shoudl alwasy be on top of balls and bricks
User prompt
move upgrade buttons 100 pixels down
User prompt
move upgrade buttons 200 pixels down
User prompt
move upgrade buttons 50 pixels to the right
User prompt
move upgrade button 10 pixels to the right and 100 down
Code edit (4 edits merged)
Please save this source code
User prompt
can you make diagonal patter look better
Code edit (5 edits merged)
Please save this source code
User prompt
add random crazy colorfull tween explosions when a brick is destoyed. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
add also particles to explosion of bricks
User prompt
prticle effect should be better
User prompt
colors of particles should be fromt eh tints of the game
User prompt
particles explossions should be ranodm and different every time
User prompt
tween effect on brick explosion should also change a be random ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (5 edits merged)
Please save this source code
User prompt
remove particle effect
Code edit (2 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -13,17 +13,9 @@
var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
- ballGraphics.tint = type === 'splash' ? 0xff0066 :
- // Neon Pink
- type === 'sniper' ? 0x00ff99 :
- // Neon Mint
- type === 'scatter' ? 0xffff00 :
- // Neon Yellow
- type === 'smallScatter' ? 0xffff00 :
- // Neon Yellow
- 0x00ffff; // Neon Cyan
+ ballGraphics.tint = type === 'splash' ? 0xff0066 : type === 'sniper' ? 0x00ff99 : type === 'scatter' ? 0xffff00 : type === 'smallScatter' ? 0xffff00 : 0x00ffff;
self.type = type;
self.speed = type === 'splash' ? upgrades.splashSpeed : type === 'sniper' ? upgrades.sniperSpeed : type === 'scatter' ? upgrades.scatterSpeed : type === 'smallScatter' ? upgrades.scatterSpeed * 0.8 : upgrades.normalSpeed;
self.power = type === 'splash' ? upgrades.splashPower : type === 'sniper' ? upgrades.sniperPower : type === 'scatter' ? upgrades.scatterPower : type === 'smallScatter' ? Math.max(1, Math.floor(upgrades.scatterPower * 0.5)) : upgrades.normalPower;
self.direction = {
@@ -105,9 +97,9 @@
self.health = 1;
self.maxHealth = 1;
self.healthText = new Text2(self.health.toString(), {
size: 50,
- fill: 0xffffff // White for neon contrast
+ fill: 0xffffff
});
self.healthText.anchor.set(0.5, 0.5);
self.addChild(self.healthText);
self.updateTint = function () {
@@ -141,9 +133,8 @@
anchorY: 0.5
});
var titleText = new Text2('Idle BrickBreaker', {
size: 150,
- // Increased font size from 100 to 150
fill: 0x000000
});
titleText.anchor.set(0.5, 0.5);
self.addChild(titleText);
@@ -152,9 +143,9 @@
var self = Container.call(this);
var buttonGraphics = self.attachAsset('resetButton', {
anchorX: 0.5,
anchorY: 0.5,
- tint: 0xff6666 // Soft red
+ tint: 0xff6666
});
var buttonText = new Text2('RESET', {
size: 50,
fill: 0x000000
@@ -171,9 +162,9 @@
var starGraphics = self.attachAsset('star', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = Math.random() * 2 + 1; // Random speed for each star
+ self.speed = Math.random() * 2 + 1;
self.update = function () {
self.y += self.speed;
if (self.y > GAME_HEIGHT) {
self.y = 0;
@@ -202,16 +193,14 @@
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x1a1a2e // Dark neon-friendly background
+ backgroundColor: 0x1a1a2e
});
/****
* Game Code
****/
-// Red color for reset button
-// Green color for start button
function _toConsumableArray2(r) {
return _arrayWithoutHoles2(r) || _iterableToArray2(r) || _unsupportedIterableToArray2(r) || _nonIterableSpread2();
}
function _nonIterableSpread2() {
@@ -279,29 +268,9 @@
var GAME_HEIGHT = 2632;
var BALL_RADIUS = 50;
var BRICK_WIDTH = 300;
var BRICK_HEIGHT = 99;
-var BALL_COST = 50;
-var LEVEL_COLORS = [0xff00ff,
-// Neon Magenta
-0x00ffff,
-// Neon Cyan
-0xffff00,
-// Neon Yellow
-0xff0066,
-// Neon Pink
-0x00ff99,
-// Neon Mint
-0xff33cc,
-// Neon Hot Pink
-0x66ff33,
-// Neon Lime
-0xcc00ff,
-// Neon Purple
-0x33ffcc,
-// Neon Turquoise
-0xff3300 // Neon Orange
-];
+var LEVEL_COLORS = [0xff00ff, 0x00ffff, 0xffff00, 0xff0066, 0x00ff99, 0xff33cc, 0x66ff33, 0xcc00ff, 0x33ffcc, 0xff3300];
var levelConfig = {
1: {
totalBricks: 30,
hitpoints: 1,
@@ -330,38 +299,8 @@
totalBricks: 110,
hitpoints: 5,
gridSize: 240,
pattern: 'sparse'
- },
- 6: {
- totalBricks: 130,
- hitpoints: 6,
- gridSize: 220,
- pattern: 'grid'
- },
- 7: {
- totalBricks: 150,
- hitpoints: 7,
- gridSize: 200,
- pattern: 'staggered'
- },
- 8: {
- totalBricks: 170,
- hitpoints: 8,
- gridSize: 180,
- pattern: 'clustered'
- },
- 9: {
- totalBricks: 190,
- hitpoints: 9,
- gridSize: 160,
- pattern: 'diagonal'
- },
- 10: {
- totalBricks: 210,
- hitpoints: 10,
- gridSize: 140,
- pattern: 'sparse'
}
};
var upgrades = storage.upgrades || {
normalSpeed: 1,
@@ -381,8 +320,10 @@
sniperPowerCost: 100,
scatterSpeedCost: 50,
scatterPowerCost: 75,
clickCost: 25,
+ normalBallCost: 50,
+ // Integrated BALL_COST into upgrades
splashBallCost: 100,
sniperBallCost: 150,
scatterBallCost: 125
};
@@ -407,9 +348,8 @@
sniper: false,
scatter: false
};
storage.upgrades = {
- // Reset upgrades storage data
normalSpeed: 1,
normalPower: 1,
splashSpeed: 1,
splashPower: 1,
@@ -426,8 +366,9 @@
sniperPowerCost: 100,
scatterSpeedCost: 50,
scatterPowerCost: 75,
clickCost: 25,
+ normalBallCost: 50,
splashBallCost: 100,
sniperBallCost: 150,
scatterBallCost: 125
};
@@ -443,16 +384,16 @@
LK.gui.top.addChild(hud);
var scoreTxt = new Text2('$0', {
size: 60,
fill: 0x00ffff
-}); // Neon Cyan
+});
scoreTxt.anchor.set(0.3, 0);
scoreTxt.x += 450;
hud.addChild(scoreTxt);
var levelTxt = new Text2('Level: ' + level, {
size: 60,
fill: 0x00ffff
-}); // Neon Cyan
+});
levelTxt.anchor.set(1, 0);
levelTxt.x = scoreTxt.x + 100;
levelTxt.y = scoreTxt.height + 10;
hud.addChild(levelTxt);
@@ -460,9 +401,8 @@
function createBallButton(type, x, cost, asset, prevTier) {
var button = LK.getAsset('button', {
size: 80,
fill: 0x1a1a2e,
- // Dark base
anchorX: 0.5,
anchorY: 0,
y: 50,
x: x
@@ -474,60 +414,51 @@
anchorY: -0.5,
scaleX: 0.6,
scaleY: 0.6,
y: -10,
- tint: type === 'splash' ? 0xff0066 :
- // Neon Pink
- type === 'sniper' ? 0x00ff99 :
- // Neon Mint
- type === 'scatter' ? 0xffff00 :
- // Neon Yellow
- 0x00ffff // Neon Cyan
+ tint: type === 'splash' ? 0xff0066 : type === 'sniper' ? 0x00ff99 : type === 'scatter' ? 0xffff00 : 0x00ffff
});
contentContainer.addChild(ballIcon);
var typeText = new Text2(type.charAt(0).toUpperCase() + type.slice(1), {
size: 30,
- fill: 0xffffff // White for contrast
+ fill: 0xffffff
});
typeText.anchor.set(0.5, 0);
typeText.y = -50;
button.addChild(typeText);
- var costText = new Text2('$' + cost, {
+ var costText = new Text2('$' + upgrades[type + 'BallCost'], {
size: 50,
- fill: 0x00ffff // Neon Cyan
+ fill: 0x00ffff
});
costText.anchor.set(0.5, 0);
costText.y = 100;
button.addChild(costText);
button.interactive = true;
button.down = function () {
- if (score < cost) {
+ if (score < upgrades[type + 'BallCost']) {
return;
}
- score -= cost;
+ score -= upgrades[type + 'BallCost'];
scoreTxt.setText('$' + score.toString());
createBall(type);
- upgrades[type + 'BallCost'] = Math.floor(upgrades[type + 'BallCost'] * 1.1); // Increase cost by 10%
- if (type === 'normal') {
- BALL_COST = Math.floor(BALL_COST * 1.1); // Increase normal ball cost by 10%
- }
- storage.upgrades = Object.assign({}, upgrades); // Save updated cost to storage
- costText.setText('$' + upgrades[type + 'BallCost']); // Update cost display
+ upgrades[type + 'BallCost'] = Math.floor(upgrades[type + 'BallCost'] * 1.1);
+ storage.upgrades = Object.assign({}, upgrades);
+ costText.setText('$' + upgrades[type + 'BallCost']);
if (!unlockedTiers[type]) {
unlockedTiers[type] = true;
storage.unlockedTiers = Object.assign({}, unlockedTiers);
updateButtonStates();
}
};
button.updateState = function () {
- var isEnabled = (prevTier ? unlockedTiers[prevTier] : true) && score >= cost;
- button.tint = isEnabled ? 0x00ffff : 0x666666; // Neon Cyan when enabled
+ var isEnabled = (prevTier ? unlockedTiers[prevTier] : true) && score >= upgrades[type + 'BallCost'];
+ button.tint = isEnabled ? 0x00ffff : 0x666666;
button.interactive = isEnabled;
};
hud.addChild(button);
ballButtons[type] = button;
}
-createBallButton('normal', -400, BALL_COST, 'ball', null);
+createBallButton('normal', -400, upgrades.normalBallCost, 'ball', null);
createBallButton('splash', -280, upgrades.splashBallCost, 'splashBall', 'normal');
createBallButton('sniper', -160, upgrades.sniperBallCost, 'sniperBall', 'splash');
createBallButton('scatter', -40, upgrades.scatterBallCost, 'scatterBall', 'sniper');
var clearStorageButton = LK.getAsset('button', {
@@ -594,9 +525,8 @@
button.interactive = true;
button.down = function () {
var cost = baseCost * upgrades[upgradeKey];
var ballType = upgradeKey.split('Speed')[0].split('Power')[0];
- // Special handling for clickDamage - no tier dependency
if (upgradeKey === 'clickDamage') {
if (score < cost) {
return;
}
@@ -606,9 +536,9 @@
}
}
score -= cost;
upgrades[upgradeKey]++;
- storage.upgrades = Object.assign({}, upgrades); // Save upgrades to local storage
+ storage.upgrades = Object.assign({}, upgrades);
costText.setText('$' + (baseCost * upgrades[upgradeKey]).toString());
labelText.setText("".concat(labelPrefix, " x").concat(upgrades[upgradeKey]));
scoreTxt.setText('$' + score.toString());
balls.forEach(function (b) {
@@ -623,9 +553,9 @@
}
});
if (upgradeKey === 'clickDamage') {
upgrades.clickDamage = upgrades[upgradeKey];
- storage.upgrades = Object.assign({}, upgrades); // Save upgrades to local storage
+ storage.upgrades = Object.assign({}, upgrades);
}
};
button.updateState = function () {
var ballType = upgradeKey.split('Speed')[0].split('Power')[0];
@@ -665,13 +595,11 @@
upgradeButton.addChild(upgradeText);
upgradeButton.down = function () {
powerupContainer.visible = !powerupContainer.visible;
};
-upgradeButton.visible = false; // Initially hide upgrade button
+upgradeButton.visible = false;
game.addChild(upgradeButton);
-// Initially hide top elements
hud.visible = false;
-// Helper Functions
function updateButtonStates() {
for (var type in ballButtons) {
ballButtons[type].updateState();
}
@@ -900,23 +828,20 @@
return;
}
}
};
-// Create and add stars to the game background
var stars = [];
for (var i = 0; i < 100; i++) {
var star = new Star();
star.x = Math.random() * GAME_WIDTH;
star.y = Math.random() * GAME_HEIGHT;
stars.push(star);
- game.addChildAt(star, 0); // Add stars behind other elements
+ game.addChildAt(star, 0);
}
-// Initialize game elements
var gameTitle = new GameTitle();
gameTitle.x = GAME_WIDTH / 2;
gameTitle.y = GAME_HEIGHT / 2 - 600;
game.addChild(gameTitle);
-// Add color and animation to the title
function animateTitleColor() {
tween(gameTitle, {
tint: 0xff33cc
}, {
@@ -927,9 +852,9 @@
tint: 0x00ff99
}, {
duration: 2000,
easing: tween.easeInOut,
- onFinish: animateTitleColor // Recursively call to keep changing color
+ onFinish: animateTitleColor
});
}
});
}
@@ -941,10 +866,10 @@
easing: tween.bounceOut
});
var startButton = new StartButton();
startButton.x = GAME_WIDTH / 2;
-startButton.y = GAME_HEIGHT / 2 + 300; // Moved 200 pixels down
-startButton.tint = 0x00ff99; // Apply green tint to match game style
+startButton.y = GAME_HEIGHT / 2 + 300;
+startButton.tint = 0x00ff99;
game.addChild(startButton);
tween(startButton, {
y: startButton.y - 20
}, {
@@ -980,10 +905,10 @@
function startGame() {
startButton.destroy();
gameTitle.destroy();
resetButton.visible = false;
- upgradeButton.visible = true; // Show upgrade button
- hud.visible = true; // Show top elements
+ upgradeButton.visible = true;
+ hud.visible = true;
createBricks();
updateButtonStates();
game.update = function () {
for (var i = 0; i < stars.length; i++) {