Code edit (9 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Timeout.tick error: isGamePaused is not defined' in or related to this line: 'if (!isGamePaused) {' Line Number: 440
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'x')' in or related to this line: 'currentBackground.x = 2048 / 2;' Line Number: 398
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: round is not defined' in or related to this line: 'var currentBackground = LK.getAsset('background' + round, {' Line Number: 431
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: displayRoundText is not defined' in or related to this line: 'displayRoundText(gameRound);' Line Number: 454
Code edit (2 edits merged)
Please save this source code
User prompt
add handswithgloves asset to screen
Code edit (1 edits merged)
Please save this source code
User prompt
only increase score if entire ball goes through basket
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: game.addchild is not a function' in or related to this line: 'game.addchild(self.leftElement);' Line Number: 219
Code edit (1 edits merged)
Please save this source code
Code edit (23 edits merged)
Please save this source code
User prompt
make the roundText opaque
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
remove the little ball at the top left of the screen
User prompt
if ball intersects with defender reset multiplier
User prompt
if ball intersects with defender remove multiplier
Code edit (1 edits merged)
Please save this source code
User prompt
once score reaches 2 change background to background2
===================================================================
--- original.js
+++ change.js
@@ -352,47 +352,15 @@
anchorY: 0.5
});
var powerBar3Displayed = false;
var powerBar4Displayed = false;
-LK.on('tick', function () {
- if (Math.abs(defender.x - defender.targetX) <= 5 && Math.abs(defender.y - defender.targetY) <= 5) {
- defender.pickNewTarget();
- defender.distanceFromTarget();
- defender.move();
- } else {
- defender.move();
- }
- if (ball.hasThrown) {
- // Create a fire particle only when there is a multiplier
- if (scoreMultiplier == 2) {
- var particle = new Particle();
- particle.alpha = 0.8;
- // Set fire particle color to yellow for x2 multiplier
- particle.tint = 0xFFFF00; // Yellow color
- var angle = Math.random() * Math.PI * 2;
- var radius = ball.width * 0.5 * Math.sqrt(Math.random());
- particle.x = ball.x + Math.cos(angle) * radius;
- particle.y = ball.y + Math.sin(angle) * radius;
- game.addChild(particle);
- } else if (scoreMultiplier >= 3) {
- var particle = new Particle();
- particle.alpha = 0.8;
- // Set fire particle color to red and increase size for x3 or higher multiplier
- particle.tint = 0xFF0000; // Red color
- particle.scale.set(1.5); // Increase size
- var angle = Math.random() * Math.PI * 2;
- var radius = ball.width * 0.75 * Math.sqrt(Math.random()); // Increase radius for bigger particles
- particle.x = ball.x + Math.cos(angle) * radius;
- particle.y = ball.y + Math.sin(angle) * radius;
- game.addChild(particle);
- }
- }
-});
var gameRound = 1;
var currentBackground = LK.getAsset('background' + gameRound, {
anchorX: 0.5,
anchorY: 0.5
});
+// ***
+// This function resets/updates the assets at each round
var newRoundFunc = function newRoundFunc(round) {
// background
game.removeChild(currentBackground);
currentBackground = LK.getAsset('background' + round, {
@@ -443,9 +411,8 @@
};
var resumeGame = function resumeGame() {
isGamePaused = false;
};
-// Cycle between direction1 and direction9 every .5 seconds
var timerInterval = LK.setInterval(function () {
if (!isGamePaused) {
gameTime--;
if (gameTime <= 0) {
@@ -528,9 +495,43 @@
});
var floorY = 2632 + 900 * (ball.scale.y - 1);
ball.y = floorY - ball.height;
powerBarIncrease = 0;
+// ***
+// MAIN GAME LOOP
LK.on('tick', function () {
+ if (Math.abs(defender.x - defender.targetX) <= 5 && Math.abs(defender.y - defender.targetY) <= 5) {
+ defender.pickNewTarget();
+ defender.distanceFromTarget();
+ defender.move();
+ } else {
+ defender.move();
+ }
+ if (ball.hasThrown) {
+ // Create a fire particle only when there is a multiplier
+ if (scoreMultiplier == 2) {
+ var particle = new Particle();
+ particle.alpha = 0.8;
+ // Set fire particle color to yellow for x2 multiplier
+ particle.tint = 0xFFFF00; // Yellow color
+ var angle = Math.random() * Math.PI * 2;
+ var radius = ball.width * 0.5 * Math.sqrt(Math.random());
+ particle.x = ball.x + Math.cos(angle) * radius;
+ particle.y = ball.y + Math.sin(angle) * radius;
+ game.addChild(particle);
+ } else if (scoreMultiplier >= 3) {
+ var particle = new Particle();
+ particle.alpha = 0.8;
+ // Set fire particle color to red and increase size for x3 or higher multiplier
+ particle.tint = 0xFF0000; // Red color
+ particle.scale.set(1.5); // Increase size
+ var angle = Math.random() * Math.PI * 2;
+ var radius = ball.width * 0.75 * Math.sqrt(Math.random()); // Increase radius for bigger particles
+ particle.x = ball.x + Math.cos(angle) * radius;
+ particle.y = ball.y + Math.sin(angle) * radius;
+ game.addChild(particle);
+ }
+ }
powerBarIncrease += 1;
if (powerBarIncrease % 10 == 0) {
if (mouseDownTime > 0) {
cyclePowerBars();
@@ -646,26 +647,16 @@
if (hoop.x > 2048 - hoop.width / 2) {
hoop.x = hoop.width / 2;
}
hoopRim.x = hoop.x;
- if (score >= 30) {
+ if (score >= 3) {
score = 0; // Reset score to 0
gameTime = 100; // Reset timer to 100
timerTxt.setText(gameTime.toString()); // Update timer display
hoop.scoreLabel.setText(score.toString());
hoop.setScore(score);
gameRound = gameRound + 1;
newRoundFunc(gameRound);
- } else if (score === 30) {
- var bg2 = LK.getAsset('background2', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- bg2.x = 2048 / 2;
- bg2.y = 2732 / 2;
- game.addChild(bg2);
- } else if (score === 2024) {
- LK.showGameOver();
} else {
hoop.scoreLabel.setText(score.toString());
hoop.setScore(score);
}
Basketball, cartoon style Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
4:3 Simple rectangle white outline. Black background
Paris. Paris basketball backgroung. Eiffel Tower. Eurosport logo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
rainbow sparkle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
two white palms facing forward no background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. HD Color
POV basketball court in forest. Full screen. Background. High detail
basketball barn background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
basketball dungeon background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
heaven background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pow effect. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
left hand. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Wide Single Orange metal bar lying down Single Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast. —ar 2:1
https://kagi.com/proxy/basketball_backboard.png?c=iNrrnnUOe99nVfDGJsYBLujiaX2Hu-zxBFRkvLEyXdRnJ8cU3RjcAYbR-o12E923qVNGy1CEGrQG87ogCD3yUarJdZYt5R03mmEMb7Jrh-8%3D blank backboard Single Game Texture. In-Game asset. 2d. Pixelart. White background. Blank background. Low detail. High contrast.