Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -354,10 +354,28 @@
var powerBar3Displayed = false;
var powerBar4Displayed = false;
var gameRound = 1;
var currentBackground;
-var timerTxt;
+var timerTxt = new Text2('100', {
+ size: 150,
+ fill: "#ffffff"
+});
+timerTxt.anchor.set(0, 0);
+timerTxt.x = 50;
+timerTxt.y = 50;
var gameTime = 100;
+var score = 0;
+var scoreMultiplier = 1;
+var hoop = game.addChild(new Hoop());
+var defender = game.addChild(new Defender());
+defender.x = 2048 / 2;
+defender.y = 2732 / 2 - 500; // Position above the hoop
+defender.distanceFromTarget();
+var ballShadow = LK.getAsset('ballShadow', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+ballShadow.alpha = 0.5;
// ***
// This function resets/updates the assets at each round
var newRoundFunc = function newRoundFunc(round) {
// background
@@ -384,36 +402,30 @@
LK.setTimeout(function () {
game.removeChild(roundText);
}, 3000);
// Timer text
- LK.gui.topLeft.removeChild(timerTxt);
- timerTxt = new Text2('100', {
- size: 150,
- fill: "#ffffff"
- });
- timerTxt.anchor.set(0, 0);
- timerTxt.x = 50;
- timerTxt.y = 50;
LK.gui.topLeft.addChild(timerTxt);
+ // add b-ball assets in correct order
+ game.addChild(hoop);
+ game.addChild(defender);
+ game.addChild(ballShadow);
};
+// Start newround
newRoundFunc(gameRound);
-var hoop = game.addChild(new Hoop());
-var defender = game.addChild(new Defender());
-defender.x = 2048 / 2;
-defender.y = 2732 / 2 - 500; // Position above the hoop
-defender.distanceFromTarget();
-var score = 0;
-var scoreMultiplier = 1;
-var ballShadow = LK.getAsset('ballShadow', {
- anchorX: 0.5,
- anchorY: 0.5
-});
-ballShadow.alpha = 0.5;
-game.addChild(ballShadow);
+// updates the clock or something
+var isGamePaused = false;
+var timerInterval = LK.setInterval(function () {
+ if (!isGamePaused) {
+ gameTime--;
+ if (gameTime <= 0) {
+ LK.clearInterval(timerInterval);
+ LK.showGameOver();
+ return;
+ }
+ timerTxt.setText(gameTime.toString());
+ }
+}, 1000);
var ball = game.addChild(new Ball());
-var powerBall = game.addChild(new PowerBall());
-powerBall.x = ball.x + ball.width / 2 + powerBall.width / 2 + 20; // Position powerball to the right of the ball
-powerBall.y = ball.y; // Align horizontally with the ball
var hoopRim = game.addChild(new HoopRim());
ball.hitElement = '';
hoop.x = 2048 / 2;
hoop.y = 2732 / 2;
@@ -445,10 +457,10 @@
var pos = event.getLocalPosition(game);
var dx = pos.x - dragStart.x;
var dy = pos.y - dragStart.y;
var angle = Math.atan2(dy, dx);
- ball.speed.x = -ball.throwSpeed * Math.cos(angle) * 30 * (0.9 + powerBall.powerLevel / 10) / 3 * 1.5;
- ball.speed.y = -ball.throwSpeed * Math.sin(angle) * 30 * (0.9 + powerBall.powerLevel / 10) * 1.5;
+ ball.speed.x = -ball.throwSpeed * Math.cos(angle) * 30;
+ ball.speed.y = -ball.throwSpeed * Math.sin(angle) * 30;
ball.hasThrown = true;
ball.hitElement = '';
game.removeChild(ball);
game.addChild(ball);
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.