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
User prompt
Check ball tier purchase
User prompt
game should start with no ball on the screen until player buys one
User prompt
remove initial ball creation on game start
User prompt
check the logic on the ball tier. Make sure that after I buy the normal ball, the splash ball tier is unlocked.
User prompt
make text of Click x1 bigger
User prompt
Click upgrade is not working
User prompt
upgrades for a ball should be disabled if that ball has not been purchased yet. to mark them, just show an emptyball asset instead of their ball. update it when availebel
User prompt
create emptyball asset
Code edit (1 edits merged)
Please save this source code
User prompt
change all the text color to black
User prompt
all balls should use ball asset but with different titns
User prompt
for icons also use ball asset with tint
User prompt
if a ball has not been purchased its upgrades should be disabled
User prompt
Make sure splash ball is not enabled until at least one normal ball was purchased
User prompt
make sure ball asset is always over the asset for the ebuttons
User prompt
in ball buttons put the name of the ball tipe below it and under the price, and reduce the size
User prompt
Can you use a nice font for the game
User prompt
can you put the name of the ball buttons on top of them instead
User prompt
move ball buttons 50 pixels down
User prompt
remove the pointer fromt he screen
User prompt
Please fix the bug: 'pointerIcon is not defined' in or related to this line: 'pointerIcon.visible = !unlockedTiers[type];' Line Number: 342
User prompt
make the ball icon bigger in the ball button
===================================================================
--- original.js
+++ change.js
@@ -135,11 +135,8 @@
/****
* Game Code
****/
-// New asset for unpurchased ball upgrades
-// Unused in this update
-var _storage$unlockedTier, _storage$unlockedTier2, _storage$unlockedTier3, _storage$unlockedTier4;
function _toConsumableArray(r) {
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
function _nonIterableSpread() {
@@ -238,13 +235,13 @@
var brickGrid = {};
var score = 10000; // Initialize score to 10000 for development purposes
var level = storage.level || 1;
var brickGridBounds = null;
-var unlockedTiers = {
- 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
+var unlockedTiers = storage.unlockedTiers || {
+ normal: true,
+ splash: false,
+ sniper: false,
+ scatter: false
};
function clearLocalStorage() {
storage.score = 0;
storage.level = 1;
@@ -255,14 +252,9 @@
scatter: false
};
score = 0;
level = 1;
- unlockedTiers = {
- normal: true,
- splash: false,
- sniper: false,
- scatter: false
- };
+ unlockedTiers = Object.assign({}, storage.unlockedTiers);
scoreTxt.setText('$' + score.toString());
levelTxt.setText('Level: ' + level);
updateButtonStates();
}
@@ -306,34 +298,34 @@
anchorY: -0.5,
scaleX: 0.5,
scaleY: 0.5
}));
- // Add pointer icon to the button
var pointerIcon = LK.getAsset('pointer', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.3,
scaleY: 0.3,
- y: -50 // Position the pointer icon above the button
+ y: -50
});
button.addChild(pointerIcon);
button.down = function () {
- if (!unlockedTiers[type] || score < cost) {
+ if (score < cost) {
return;
}
score -= cost;
scoreTxt.setText('$' + score.toString());
createBall(type);
if (!unlockedTiers[type]) {
unlockedTiers[type] = true;
- storage.unlockedTiers = unlockedTiers;
+ storage.unlockedTiers = Object.assign({}, unlockedTiers);
updateButtonStates();
}
};
button.updateState = function () {
var isEnabled = (prevTier ? unlockedTiers[prevTier] : true) && score >= cost;
button.tint = isEnabled ? 0xFFFFFF : 0x666666;
button.interactive = isEnabled;
+ pointerIcon.visible = !unlockedTiers[type];
};
hud.addChild(button);
ballButtons[type] = button;
}
@@ -358,19 +350,18 @@
clearStorageButton.addChild(clearStorageText);
clearStorageButton.down = clearLocalStorage;
hud.addChild(clearStorageButton);
var powerupContainer = new Container();
-powerupContainer.y = 1800; // Move the powerup container 1100 pixels down
-powerupContainer.visible = false; // Hide the powerup buttons initially
+powerupContainer.y = 1800;
+powerupContainer.visible = false;
game.addChild(powerupContainer);
var bottomHud = new Container();
-bottomHud.y = GAME_HEIGHT - 200; // Adjusted higher to fit larger buttons
+bottomHud.y = GAME_HEIGHT - 200;
game.addChild(bottomHud);
var upgradeButtons = {};
function createUpgradeButton(labelPrefix, x, costKey, upgradeKey, baseCost, iconType, prevTier) {
var button = LK.getAsset('powerupbutton', {
size: 150,
- // Increased from 80 to 150 for larger buttons
fill: 0xFFFFFF,
anchorX: 0.5,
anchorY: 0,
x: x,
@@ -381,24 +372,24 @@
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.5,
scaleY: 0.5,
- y: 40 // Move the icon 40 pixels down
- })); // Adjusted icon size and position
+ y: 40
+ }));
}
var labelText = new Text2("".concat(labelPrefix, " x").concat(upgrades[upgradeKey]), {
size: 30,
fill: 0xFFFFFF
});
labelText.anchor.set(0.5, 0);
- labelText.y = 100; // Moved 40 pixels down for better alignment
+ labelText.y = 100;
button.addChild(labelText);
var costText = new Text2('$' + (baseCost * upgrades[upgradeKey]).toString(), {
size: 40,
fill: 0xFFFFFF
});
costText.anchor.set(0.5, 0);
- costText.y = 140; // Moved 40 pixels down for better alignment
+ costText.y = 140;
button.addChild(costText);
button.down = function () {
var cost = baseCost * upgrades[upgradeKey];
if (!unlockedTiers[upgradeKey.split('Speed')[0].split('Power')[0]] || score < cost) {
@@ -428,14 +419,13 @@
};
powerupContainer.addChild(button);
upgradeButtons[upgradeKey] = button;
}
-// Adjusted Upgrade Buttons with larger size and wider spacing
-var buttonWidth = 150; // Size of each button
-var spacing = 50; // Space between buttons
+var buttonWidth = 150;
+var spacing = 50;
var totalButtons = 9;
var totalWidth = totalButtons * buttonWidth + (totalButtons - 1) * spacing;
-var startX = (GAME_WIDTH - totalWidth) / 2; // Center the buttons
+var startX = (GAME_WIDTH - totalWidth) / 2;
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');
@@ -443,9 +433,8 @@
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);
-// Add UPGRADE button to toggle powerup visibility
var upgradeButton = LK.getAsset('upgrade', {
anchorX: 0.5,
anchorY: 0.5,
x: GAME_WIDTH / 2,
@@ -457,9 +446,9 @@
});
upgradeText.anchor.set(0.5, 0.5);
upgradeButton.addChild(upgradeText);
upgradeButton.down = function () {
- powerupContainer.visible = !powerupContainer.visible; // Toggle visibility
+ powerupContainer.visible = !powerupContainer.visible;
};
game.addChild(upgradeButton);
// Helper Functions
function updateButtonStates() {
@@ -646,18 +635,8 @@
}
}
balls.push(ball);
game.addChild(ball);
- if (!unlockedTiers[type]) {
- unlockedTiers[type] = true;
- storage.unlockedTiers = unlockedTiers;
- updateButtonStates();
- if (type === 'normal') {
- unlockedTiers['splash'] = true;
- storage.unlockedTiers = unlockedTiers;
- updateButtonStates();
- }
- }
}
game.update = function () {
for (var i = balls.length - 1; i >= 0; i--) {
var ball = balls[i];
@@ -676,9 +655,8 @@
levelTxt.setText('Level: ' + level);
createBricks();
}
}
- // Removed initial ball creation on game start
updateButtonStates();
};
game.down = function (x, y, obj) {
if (!bricks || !Array.isArray(bricks)) {
@@ -692,11 +670,11 @@
continue;
}
if (x >= brick.x - brick.width / 2 && x <= brick.x + brick.width / 2 && y >= brick.y - brick.height / 2 && y <= brick.y + brick.height / 2) {
brick.hit(upgrades.clickDamage);
- score += upgrades.clickDamage; // Increase score by click damage
- scoreTxt.setText('$' + score.toString()); // Update score display
- storage.score = score; // Save updated score to storage
+ score += upgrades.clickDamage;
+ scoreTxt.setText('$' + score.toString());
+ storage.score = score;
return;
}
}
};