===================================================================
--- original.js
+++ change.js
@@ -276,8 +276,9 @@
// Add reset button to the game
var resetButton = game.addChild(new ResetButton());
resetButton.x = 2048 - resetButton.width / 2;
resetButton.y = 2732 - resetButton.height / 2;
+resetButton.visible = false; // Initially hide the reset button
// Handle paddle movement
game.move = function (x, y, obj) {
paddle.x = x;
paddle.y = y;
@@ -286,8 +287,14 @@
game.update = function () {
ball.update();
paddle.update();
opponentPaddle.update();
+ // Show reset button if ball is stopped or more than half of it is out of bounds
+ if (ball.speedX === 0 && ball.speedY === 0 || ball.y < -ball.height / 2 || ball.y > 2732 + ball.height / 2) {
+ resetButton.visible = true;
+ } else {
+ resetButton.visible = false;
+ }
// Check for collision between ball and iceGateTop
if (ball.intersects(topGoal)) {
playerScore++;
scoreTxt.setText(playerScore + '-' + opponentScore);
amusement arcade Air hockey table. Top view.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Air hockey puck. Top view..
change colour from red to blue
Air hockey logo.
Reset ball button retro style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.