User prompt
add the basket class
User prompt
remove the player related code and asset also
User prompt
Please fix the bug: 'Basket is not defined' in or related to this line: 'var player = game.addChild(new Basket());' Line Number: 51
User prompt
change player asset to basket asset and in the code also
User prompt
add background asset
User prompt
Please fix the bug: 'ReferenceError: ballGraphics is not defined' in or related to this line: 'ballGraphics.tint = ballColors[colorIndex];' Line Number: 82
User prompt
if the player catch the 5 balls the ball color change to another color like that for every balls catch change the different colors
Code edit (2 edits merged)
Please save this source code
User prompt
increase the ball falling speed
User prompt
decrease the timer font size
Code edit (2 edits merged)
Please save this source code
User prompt
again 5 cm towards left
User prompt
can you move the timer 5cm towards the left
User prompt
display the timer in top middle of the screen
Code edit (1 edits merged)
Please save this source code
User prompt
set the timer 100 sec and display the timer in the screen of the game
Code edit (3 edits merged)
Please save this source code
User prompt
increase the ball count
User prompt
after 120 seconds the game will over and display the score
Code edit (1 edits merged)
Please save this source code
User prompt
fix the timer 120 seconds and increase the ball speed every 10 seconds and reduce the ball falling count and display the timer in the top right corner left
User prompt
dragging any where in the game the mouse will change please add that thing
User prompt
A ball randomly falls from the top, and the player must move a basket (or hand) to catch it. Each successful catch adds a point.
User prompt
first remove the code and assets
Initial prompt
Catch the Ball
/**** * Classes ****/ var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.attachAsset('ball', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { self.y += self.speed; }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { var game_position = game.toLocal(obj.global); self.x = game_position.x; }; }); /**** * Initialize Game ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - 100; var balls = []; var scoreTxt = new Text2('0', { size: 150, fill: 0xFFFFFF }); LK.gui.top.addChild(scoreTxt); game.update = function () { for (var a = balls.length - 1; a >= 0; a--) { var ball = balls[a]; if (ball.y > 2732) { ball.destroy(); balls.splice(a, 1); continue; } if (player.intersects(ball)) { LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); ball.destroy(); balls.splice(a, 1); continue; } } if (LK.ticks % 60 == 0) { var newBall = new Ball(); newBall.x = Math.random() * 2048; newBall.y = 0; balls.push(newBall); game.addChild(newBall); } }; game.move = function (x, y, obj) { var game_position = game.toLocal(obj.global); player.x = game_position.x; };
===================================================================
--- original.js
+++ change.js
@@ -67,5 +67,9 @@
newBall.y = 0;
balls.push(newBall);
game.addChild(newBall);
}
+};
+game.move = function (x, y, obj) {
+ var game_position = game.toLocal(obj.global);
+ player.x = game_position.x;
};
\ No newline at end of file
rock. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A sunset beach background with waves and palm trees.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
a robotic basket with high contrast. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
robotic and shiny balls. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows