Code edit (13 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Defender.pickNewTarget is not a function' in or related to this line: 'Defender.pickNewTarget();' Line Number: 313
Code edit (11 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
Correctly update the 'defender' object's position
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'x')' in or related to this line: 'self.x = hoopRim.x;' Line Number: 96
Code edit (13 edits merged)
Please save this source code
Code edit (25 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
don't pick new target unless defender is within 5 pixels of it's target
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: backboardGraphics is not defined' in or related to this line: 'self.targetX = (self.targetCorner + 1) % 4 % 3 * 3 % 5 % 2 * (backboardGraphics.x + 550);' Line Number: 106
Code edit (13 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
make the speed of the ball depend on how long the left ouse button has been held down
User prompt
make the speed of the ball depend on how long the left mouse button has been held down
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: date is not defined' in or related to this line: 'mouseDowntime = date.Now();' Line Number: 445
Code edit (2 edits merged)
Please save this source code
User prompt
Make the ball speed depend on how long the mouse is held down
User prompt
display powerBar1
User prompt
if mouse button held down for 0.2 seconds display powerBar1
User prompt
move powerbar1 to bottom right corner
User prompt
if mouse button down for .4 seconds display powerbar2
===================================================================
--- original.js
+++ change.js
@@ -4,8 +4,9 @@
var Ball = Container.expand(function () {
var self = Container.call(this);
self.hasScored = false;
self.hasBounced = false;
+ self.throwSpeed = 0;
var ballGraphics = LK.getAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
@@ -413,9 +414,9 @@
hoopRim.y = hoop.y + hoop.children[1].y - 250;
ball.x = 2048 / 2;
ball.on('down', function (obj) {
if (!ball.hasThrown) {
- mouseDowntime = Date.now();
+ mouseDownTime = Date.now();
var event = obj.event;
dragStart = event.getLocalPosition(game);
}
});
@@ -446,8 +447,10 @@
game.on('up', function (obj) {
if (dragStart !== null) {
var event = obj.event;
var pos = event.getLocalPosition(game);
+ ball.throwSpeed = (Date.Now() - mouseDownTime) / 1000;
+ mouseDownTime = 0;
var distance = Math.sqrt(Math.pow(pos.x - dragStart.x, 2) + Math.pow(pos.y - dragStart.y, 2));
if (distance > 150) {
game.fireBall(obj);
}
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.