User prompt
upgrade buttons should have a little moroe space between them
User prompt
add a little more space between the buttons for the power ups int he bottom of the screen
User prompt
add a little more space between the buttons for the power ups int he bottom of the screen
Code edit (3 edits merged)
Please save this source code
User prompt
change creatUpgradeButton position, have them have 10 pixels between each other
Code edit (2 edits merged)
Please save this source code
User prompt
play bounce sound when ball bounces
Code edit (1 edits merged)
Please save this source code
User prompt
use powerupbutton asset for theh button on t he bottom of the screen
User prompt
can you arrange better the icon and the text in the powerupbuttons from the bottom with te current size of the button. maybe put the icon on top a little smaller, and also reduce the price size
User prompt
Not bad! now jus move them 20 pixel down
User prompt
move them20 pixels down more and also move the icon down
User prompt
move the icon of the button in the bottom 40 pixels down
User prompt
but dont change the anchor, just move them
User prompt
Nnice! now increae the price size jut a bit
User prompt
but only for the button on the bottom, change the top ones bac
User prompt
add a pointer icon on the click button
User prompt
button powerups should all be inside a container and hidden. There should be an UPGRADE button in the bottom of the screen, that will open up the upgrades (in the container in their current positon.
User prompt
upgrade button shouold use its onw upgrade asset
User prompt
Upgrade container is too high, move it 500 pixels down
User prompt
move it 600 pixels down more
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
on game start give the player 10000 points. this is just for development, will remove it later
User prompt
Player should be able to buy next tier of balls once they bought the first one
===================================================================
--- original.js
+++ change.js
@@ -40,14 +40,12 @@
self.y += dy;
if (self.x <= BALL_RADIUS || self.x >= GAME_WIDTH - BALL_RADIUS) {
self.direction.x *= -1;
self.x = Math.max(BALL_RADIUS, Math.min(GAME_WIDTH - BALL_RADIUS, self.x));
- LK.getSound('bounce').play(); // Play bounce sound
}
if (self.y <= BALL_RADIUS || self.y >= GAME_HEIGHT - BALL_RADIUS) {
self.direction.y *= -1;
self.y = Math.max(BALL_RADIUS, Math.min(GAME_HEIGHT - BALL_RADIUS, self.y));
- LK.getSound('bounce').play(); // Play bounce sound
}
if (!isNearBricks(self.x, self.y)) {
return;
}
@@ -137,9 +135,9 @@
/****
* Game Code
****/
-// Constants
+// Unused in this update
var _storage$unlockedTier, _storage$unlockedTier2, _storage$unlockedTier3, _storage$unlockedTier4;
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
@@ -178,9 +176,8 @@
var BRICK_WIDTH = 300;
var BRICK_HEIGHT = 99;
var BALL_COST = 50;
var LEVEL_COLORS = [0xff00ff, 0x00ffcc, 0xccff00, 0xff6600, 0x66ffff, 0xff3366, 0xffcc00, 0x9966ff, 0x33cc33, 0xff0000];
-// Game Variables
var levelConfig = {
1: {
totalBricks: 30,
hitpoints: 1,
@@ -240,13 +237,10 @@
var brickGrid = {};
var score = storage.score || 0;
var level = storage.level || 1;
var brickGridBounds = null;
-// Track unlocked ball tiers
var unlockedTiers = {
- normal: true,
- // Normal is always unlocked
- // Normal is always unlocked
+ normal: ((_storage$unlockedTier = storage.unlockedTiers) === null || _storage$unlockedTier === void 0 ? void 0 : _storage$unlockedTier.normal) || true,
splash: ((_storage$unlockedTier2 = storage.unlockedTiers) === null || _storage$unlockedTier2 === void 0 ? void 0 : _storage$unlockedTier2.splash) || false,
sniper: ((_storage$unlockedTier3 = storage.unlockedTiers) === null || _storage$unlockedTier3 === void 0 ? void 0 : _storage$unlockedTier3.sniper) || false,
scatter: ((_storage$unlockedTier4 = storage.unlockedTiers) === null || _storage$unlockedTier4 === void 0 ? void 0 : _storage$unlockedTier4.scatter) || false
};
@@ -285,12 +279,11 @@
size: 60,
fill: 0xFFFFFF
});
levelTxt.anchor.set(1, 0);
-levelTxt.x = scoreTxt.x + 100; //{1x.1}
-levelTxt.y = scoreTxt.height + 10; //{1x.1}
+levelTxt.x = scoreTxt.x + 100;
+levelTxt.y = scoreTxt.height + 10;
hud.addChild(levelTxt);
-// Ball Purchase Buttons
var ballButtons = {};
function createBallButton(type, x, cost, asset, prevTier) {
var button = LK.getAsset('button', {
size: 80,
@@ -327,9 +320,9 @@
}
};
button.updateState = function () {
var isEnabled = (prevTier ? unlockedTiers[prevTier] : true) && score >= cost;
- button.tint = isEnabled ? 0xFFFFFF : 0x666666; // White if enabled, grey if locked
+ button.tint = isEnabled ? 0xFFFFFF : 0x666666;
button.interactive = isEnabled;
};
hud.addChild(button);
ballButtons[type] = button;
@@ -355,42 +348,42 @@
clearStorageButton.addChild(clearStorageText);
clearStorageButton.down = clearLocalStorage;
hud.addChild(clearStorageButton);
var bottomHud = new Container();
-bottomHud.y = GAME_HEIGHT - 150;
+bottomHud.y = GAME_HEIGHT - 200; // Adjusted higher to fit larger buttons
game.addChild(bottomHud);
var upgradeButtons = {};
function createUpgradeButton(labelPrefix, x, costKey, upgradeKey, baseCost, iconType, prevTier) {
var button = LK.getAsset('button', {
- size: 80,
+ size: 150,
+ // Increased from 80 to 150 for larger buttons
fill: 0xFFFFFF,
anchorX: 0.5,
anchorY: 0,
x: x,
y: 0
});
- var costText = new Text2((baseCost * upgrades[upgradeKey]).toString(), {
- size: 50,
+ var costText = new Text2('$' + (baseCost * upgrades[upgradeKey]).toString(), {
+ size: 60,
fill: 0xFFFFFF
- });
+ }); // Larger text
costText.anchor.set(0.5, 0);
- costText.y = 100;
+ costText.y = 110; // Adjusted for larger button
button.addChild(costText);
var labelText = new Text2("".concat(labelPrefix, " x").concat(upgrades[upgradeKey]), {
- size: 50,
- // Match size with costText
+ size: 40,
fill: 0xFFFFFF
- });
- labelText.anchor.set(0.5, 0); // Align with costText
- labelText.y = 50; // Ensure same spacing as costText
+ }); // Larger text
+ labelText.anchor.set(0.5, 0);
+ labelText.y = 50; // Adjusted for larger button
button.addChild(labelText);
if (iconType) {
button.addChild(button.attachAsset(iconType, {
anchorX: 0.5,
anchorY: -0.5,
- scaleX: 0.5,
- scaleY: 0.5
- }));
+ scaleX: 0.75,
+ scaleY: 0.75
+ })); // Slightly larger icons
}
button.down = function () {
var cost = baseCost * upgrades[upgradeKey];
if (!unlockedTiers[upgradeKey.split('Speed')[0].split('Power')[0]] || score < cost) {
@@ -420,18 +413,23 @@
};
bottomHud.addChild(button);
upgradeButtons[upgradeKey] = button;
}
-// Extended Upgrade Buttons with tiered unlocking
-createUpgradeButton('Speed', GAME_WIDTH / 2 - 600, 'normalSpeedCost', 'normalSpeed', 50, 'ball', null);
-createUpgradeButton('Power', GAME_WIDTH / 2 - 480, 'normalPowerCost', 'normalPower', 75, 'ball', null);
-createUpgradeButton('Speed', GAME_WIDTH / 2 - 360, 'splashSpeedCost', 'splashSpeed', 50, 'splashBall', 'normal');
-createUpgradeButton('Power', GAME_WIDTH / 2 - 240, 'splashPowerCost', 'splashPower', 75, 'splashBall', 'normal');
-createUpgradeButton('Speed', GAME_WIDTH / 2 - 120, 'sniperSpeedCost', 'sniperSpeed', 75, 'sniperBall', 'splash');
-createUpgradeButton('Power', GAME_WIDTH / 2, 'sniperPowerCost', 'sniperPower', 100, 'sniperBall', 'splash');
-createUpgradeButton('Speed', GAME_WIDTH / 2 + 120, 'scatterSpeedCost', 'scatterSpeed', 50, 'scatterBall', 'sniper');
-createUpgradeButton('Power', GAME_WIDTH / 2 + 240, 'scatterPowerCost', 'scatterPower', 75, 'scatterBall', 'sniper');
-createUpgradeButton('Click', GAME_WIDTH / 2 + 360, 'clickCost', 'clickDamage', 25, null, null);
+// Adjusted Upgrade Buttons with larger size and wider spacing
+var buttonWidth = 150; // Size of each button
+var spacing = 50; // Space between buttons
+var totalButtons = 9;
+var totalWidth = totalButtons * buttonWidth + (totalButtons - 1) * spacing;
+var startX = (GAME_WIDTH - totalWidth) / 2; // Center the buttons
+createUpgradeButton('Speed', startX, 'normalSpeedCost', 'normalSpeed', 50, 'ball', null);
+createUpgradeButton('Power', startX + (buttonWidth + spacing), 'normalPowerCost', 'normalPower', 75, 'ball', null);
+createUpgradeButton('Speed', startX + 2 * (buttonWidth + spacing), 'splashSpeedCost', 'splashSpeed', 50, 'splashBall', 'normal');
+createUpgradeButton('Power', startX + 3 * (buttonWidth + spacing), 'splashPowerCost', 'splashPower', 75, 'splashBall', 'normal');
+createUpgradeButton('Speed', startX + 4 * (buttonWidth + spacing), 'sniperSpeedCost', 'sniperSpeed', 75, 'sniperBall', 'splash');
+createUpgradeButton('Power', startX + 5 * (buttonWidth + spacing), 'sniperPowerCost', 'sniperPower', 100, 'sniperBall', 'splash');
+createUpgradeButton('Speed', startX + 6 * (buttonWidth + spacing), 'scatterSpeedCost', 'scatterSpeed', 50, 'scatterBall', 'sniper');
+createUpgradeButton('Power', startX + 7 * (buttonWidth + spacing), 'scatterPowerCost', 'scatterPower', 75, 'scatterBall', 'sniper');
+createUpgradeButton('Click', startX + 8 * (buttonWidth + spacing), 'clickCost', 'clickDamage', 25, null, null);
// Helper Functions
function updateButtonStates() {
for (var type in ballButtons) {
ballButtons[type].updateState();
@@ -616,9 +614,8 @@
}
}
balls.push(ball);
game.addChild(ball);
- // Unlock the next tier when a ball is bought
if (!unlockedTiers[type]) {
unlockedTiers[type] = true;
storage.unlockedTiers = unlockedTiers;
updateButtonStates();
@@ -647,9 +644,9 @@
score -= BALL_COST;
scoreTxt.setText('$' + score.toString());
createBall();
}
- updateButtonStates(); // Update button states each frame
+ updateButtonStates();
};
game.down = function (x, y, obj) {
if (!bricks || !Array.isArray(bricks)) {
return;
@@ -669,5 +666,5 @@
};
// Initialize game elements
createBricks();
createBall();
-updateButtonStates(); // Initial button state update
\ No newline at end of file
+updateButtonStates();
\ No newline at end of file