User prompt
The bounce of the ball depends on the arc of the Air hockey mallet, in which direction it bounces.
User prompt
move the table down with 500 units
User prompt
Add to the game a white background asset.
User prompt
Change the player paddle movement to follow the finger position
Initial prompt
vertical pong
===================================================================
--- original.js
+++ change.js
@@ -9,13 +9,20 @@
anchorX: 0.5,
anchorY: 0.5
});
self.speedY = 10;
+ self.speedX = 0;
self.update = function () {
self.y += self.speedY;
- if (self.y <= 0 || self.y >= 2732) {
+ self.x += self.speedX;
+ if (self.y <= 0) {
self.speedY *= -1;
}
+ if (self.intersects(paddle)) {
+ var angle = Math.atan2(self.y - paddle.y, self.x - paddle.x);
+ self.speedY = -10 * Math.cos(angle);
+ self.speedX = 10 * Math.sin(angle);
+ }
};
});
// Paddle class
var Paddle = Container.expand(function () {
@@ -79,7 +86,12 @@
}
// Check if ball hits the bottom of the screen
if (ball.y >= 2732) {
LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
+ ball.speedX = 0;
+ ball.speedY = 10;
+ ball.x = 2048 / 2;
+ ball.y = 2732 / 2;
+ score = 0;
+ scoreTxt.setText(score);
}
};
\ No newline at end of file
New ball button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
air hockey table with neon lights. top view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Air hockey disk with neon green lights. top view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Air hockey disk with neon yellow lights. top view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Air hockey disk with neon orange lights. top view. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.