User prompt
the 0 - 0 doesnt work
User prompt
Make a tennis background
User prompt
when tennis ball hits racket lay MusicBG1
User prompt
Add a line in the middle of the screen to represent the little tennis line
User prompt
Make it when the tennis racket touches the ball, Play MusicBG1
User prompt
Make it so every 5 hits, The ball goes faster
User prompt
The score doesnt work
Initial prompt
Tennis Racket
===================================================================
--- original.js
+++ change.js
@@ -63,12 +63,8 @@
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var playerScore = 0;
var aiScore = 0;
-var line = game.addChild(LK.getAsset('line', {
- x: 1024,
- y: 1366
-}));
function updateScore() {
scoreTxt.setText(playerScore + ' - ' + aiScore);
}
game.move = function (x, y, obj) {
@@ -84,26 +80,21 @@
} else {
aiPaddle.x -= 5;
}
// Ball collision with paddles
- var hitCount = 0;
if (ball.intersects(playerPaddle) || ball.intersects(aiPaddle)) {
ball.speedY *= -1;
- hitCount++;
- if (hitCount % 5 == 0) {
- ball.speedY *= 1.2;
- ball.speedX *= 1.2;
- }
+ // Play MusicBG1 when tennis ball hits the racket
LK.getSound('MusicBG1').play();
}
// Scoring
if (ball.y <= 0) {
- aiScore++;
+ playerScore++;
updateScore();
ball.x = 1024;
ball.y = 1366;
} else if (ball.y >= 2732) {
- playerScore++;
+ aiScore++;
updateScore();
ball.x = 1024;
ball.y = 1366;
}
Tennis Racket. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Tennis Ball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Tennis Court Background. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. Up view