User prompt
make ball move by clicking A
User prompt
make 0 gravity
User prompt
Please fix the bug: 'ReferenceError: basketGraphics is not defined' in or related to this line: 'if (self.x > 2048 - basketGraphics.width / 2 || self.x < basketGraphics.width / 2) {' Line Number: 35
User prompt
make basket move
User prompt
make ball move
User prompt
make it 3d
Initial prompt
basket passer
===================================================================
--- original.js
+++ change.js
@@ -29,8 +29,24 @@
if (self.y > 2732 - ballGraphics.height / 2) {
self.y = 2732 - ballGraphics.height / 2;
self.vy = 0;
}
+ if (self.x > 2048 - ballGraphics.width / 2) {
+ self.x = 2048 - ballGraphics.width / 2;
+ self.vx = 0;
+ }
+ if (self.x < ballGraphics.width / 2) {
+ self.x = ballGraphics.width / 2;
+ self.vx = 0;
+ }
+ if (self.x > 2048 - ballGraphics.width / 2) {
+ self.x = 2048 - ballGraphics.width / 2;
+ self.vx = 0;
+ }
+ if (self.x < ballGraphics.width / 2) {
+ self.x = ballGraphics.width / 2;
+ self.vx = 0;
+ }
};
self.vx = 0;
self.vy = 0;
self.gravity = 0.5;
@@ -57,8 +73,10 @@
var dragNode = null;
game.down = function (x, y, obj) {
if (basketball.intersects(obj)) {
dragNode = basketball;
+ dragNode.vx = 0;
+ dragNode.vy = 0;
}
};
game.move = function (x, y, obj) {
if (dragNode) {
@@ -82,8 +100,9 @@
basketball.x = 1024;
basketball.y = 2000;
basketball.vx = 0;
basketball.vy = 0;
+ basketball.gravity = 0.5;
}
};
// Display score
var scoreTxt = new Text2('0', {