Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: customFrameGraphics is not defined' in or related to this line: 'tween(customFrameGraphics, {' Line Number: 468 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 1470
User prompt
can we have reste button also fade in when game is loaded ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Sorry do not fade in rest button, just make it tween in like the title but from the bottom of the screne ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
can you please comment out all levels except level 1
Code edit (7 edits merged)
Please save this source code
User prompt
plese breat the welcome message in two l ines and adjust its position
User prompt
center justify the text in the welcome message
Code edit (2 edits merged)
Please save this source code
User prompt
Add this variables that will be used in the future: var lastRunStartTime = 0; var lastRunTime = 0; var ballDamage = { normal: 0, splash: 0, sniper: 0, scatter: 0, smallScatter: 0 };
Code edit (5 edits merged)
Please save this source code
User prompt
move endscreen title 100 pixelss down
User prompt
Move endscreen title 100 pixels more, and so the rest of the endscreen elelments
Code edit (6 edits merged)
Please save this source code
User prompt
lets add a background asset for that covers all the text in the endscreen, from congratulations to the note
User prompt
use resultsbg instead of frame for the endscreen
Code edit (14 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -121,8 +121,9 @@
self.velocity.x += (Math.random() - 0.5) * 0.2;
self.velocity.y += (Math.random() - 0.5) * 0.2;
LK.getSound('bounce').play();
brick.hit(self.power);
+ ballDamage[self.type] = (ballDamage[self.type] || 0) + self.power;
if (self.type === 'splash' && !splashApplied) {
applySplashDamage(brick);
splashApplied = true;
} else if (self.type === 'scatter') {
@@ -531,19 +532,22 @@
});
bricks.forEach(function (brick) {
return brick.visible = false;
});
+ // Calculate last run time
+ lastRunTime = Math.floor((Date.now() - lastRunStartTime) / 1000);
var congratsText = new Text2('Congratulations! You broke them ALL!', {
size: 100,
fill: 0xffffff
});
congratsText.anchor.set(0.5, 0);
congratsText.x = GAME_WIDTH / 2;
- congratsText.y = GAME_HEIGHT / 2 - 500 + 550;
+ congratsText.y = GAME_HEIGHT / 2 - 600; // Moved up slightly
game.addChild(congratsText);
+ // Move game title up
var gameTitle = new GameTitle();
gameTitle.x = GAME_WIDTH / 2;
- gameTitle.y = congratsText.y - 500;
+ gameTitle.y = congratsText.y - 600; // Moved up more
gameTitleContainer.addChild(gameTitle);
function animateEndTitleColor() {
tintEndScreenTitle();
tween(gameTitle, {
@@ -562,23 +566,41 @@
}
});
}
animateEndTitleColor();
- var playTimeText = new Text2('Time Played: ' + playTime + ' seconds', {
- size: 80,
+ var playTimeText = new Text2('Total Time Played: ' + playTime + ' seconds', {
+ size: 60,
fill: 0xffffff
});
playTimeText.anchor.set(0.5, 0);
playTimeText.x = GAME_WIDTH / 2;
- playTimeText.y = congratsText.y + 300;
+ playTimeText.y = congratsText.y + 200;
game.addChild(playTimeText);
+ var lastRunText = new Text2('Last Run Time: ' + lastRunTime + ' seconds', {
+ size: 60,
+ fill: 0xffffff
+ });
+ lastRunText.anchor.set(0.5, 0);
+ lastRunText.x = GAME_WIDTH / 2;
+ lastRunText.y = playTimeText.y + 100;
+ game.addChild(lastRunText);
+ // Add damage stats
+ var damageText = new Text2('Damage Dealt This Run:\n' + 'Normal: ' + ballDamage.normal + '\n' + 'Splash: ' + ballDamage.splash + '\n' + 'Sniper: ' + ballDamage.sniper + '\n' + 'Scatter: ' + ballDamage.scatter + '\n' + 'Small Scatter: ' + ballDamage.smallScatter, {
+ size: 50,
+ fill: 0xffffff,
+ align: 'center'
+ });
+ damageText.anchor.set(0.5, 0);
+ damageText.x = GAME_WIDTH / 2;
+ damageText.y = lastRunText.y + 150;
+ game.addChild(damageText);
var noteText = new Text2('Start over with all your upgrades, or reset for a fresh new run! Your choice!', {
size: 50,
fill: 0xffffff
});
noteText.anchor.set(0.5, 0);
noteText.x = GAME_WIDTH / 2;
- noteText.y = playTimeText.y + 400;
+ noteText.y = damageText.y + 300;
game.addChild(noteText);
var endGameButton = new Container();
var buttonGraphics = endGameButton.attachAsset('endGameButton', {
anchorX: 0.5,
@@ -592,9 +614,9 @@
});
buttonText.anchor.set(0.5, 0.5);
endGameButton.addChild(buttonText);
endGameButton.x = GAME_WIDTH / 2;
- endGameButton.y = GAME_HEIGHT - 240;
+ endGameButton.y = noteText.y + 200;
endGameButton.interactive = true;
endGameButton.down = function () {
storage.level = 1;
LK.showGameOver();
@@ -689,11 +711,11 @@
pattern: 'custom',
customPattern: [[0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0], [0, 444, 444, 444, 0]]
},
16: {
- totalBricks: 140,
- pattern: 'custom',
- customPattern: [[555, 555, 555, 555, 555, 555, 555], [555, 555, 555, 555, 555, 555, 555], [555, 555, 555, 555, 555, 555, 555], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0], [0, 0, 555, 555, 555, 0, 0]]
+ totalBricks: 112,
+ hitpoints: 15,
+ pattern: 'clustered'
}
};
var upgrades = storage.upgrades || {
normalSpeed: 1,
@@ -1060,8 +1082,9 @@
var isHorizontalAdjacent = dx <= horizontalMaxDistance && dy <= BRICK_HEIGHT / 2;
var isVerticalAdjacent = dy <= verticalMaxDistance && dx <= BRICK_WIDTH / 2;
if (isHorizontalAdjacent || isVerticalAdjacent) {
adjBrick.hit(splashDamage);
+ ballDamage['splash'] = (ballDamage['splash'] || 0) + splashDamage;
}
});
}
function scatterOnImpact(ball) {
@@ -1079,8 +1102,10 @@
smallBall.velocity.x /= magnitude;
smallBall.velocity.y /= magnitude;
balls.push(smallBall);
game.addChild(smallBall);
+ // Track the initial creation damage from scatter splitting
+ ballDamage['scatter'] = (ballDamage['scatter'] || 0) + ball.power;
}
}
function findNearestBrick(x, y) {
if (bricks.length === 0) {
@@ -1472,8 +1497,13 @@
createBall('normal');
if (score > 0) {
scoreTxt.setText('$' + score.toString());
}
+ // Add this line to reset damage tracking and set start time
+ lastRunStartTime = Date.now();
+ for (var type in ballDamage) {
+ ballDamage[type] = 0;
+ }
if (storage.firstLoad !== true) {
welcomeText = new Text2(' Smash bricks, earn cash,\nbuy balls, and power up to auto-win!', {
size: 90,
fill: 0xffffff