User prompt
the all sound play in the game after the laoding scrren
User prompt
add a background in the game screen and add a shome butoon in the game
User prompt
incress the number of the blocks
User prompt
i want to use own image
User prompt
add a background at the home screen
User prompt
fix the box in the about section
User prompt
incress some speed in the eazy and more in the medium and very fast in hard like impossible and add a backgound in the home screen
User prompt
when click button open game
User prompt
rremove that enter username
User prompt
the name is still not typing there
User prompt
it was not editable i can custom name add
User prompt
player name should editable
User prompt
make the button clickable and open game
User prompt
my game is black screen
User prompt
Ping Pong Ball
Initial prompt
I want to create a ping pong ball game. In the game home screen there is a button at the cornor with just a logo of " A Person" when we click that logo a pop-up window apper. In that window written firstly the game title name with big letter. and size. Add there a a note under that " This game is build by a student so if you feel any bug and glich or issue. Please tell to me. I will fix it as soon as Possible" Thank You Inder it add a email button my email is " [email protected]" This button open email to send mails. At the end this line " Made by mohit Dudi" last " All copyright 2025 reserved by mohit dudi" In the game home screen there are 3 option " easy" "Medium" "Hard". In each mode ball speed will change. When we click any option. A box appear in a pop-up type box and it ask for player name. After adding name click on " Done". Then Game will open and The player name which we entered display on the peddler. It also move with the peddle like it is stuck or written on it. After a countdown start and game start the ball hit the block and it destroy. After destroy all blocks score is 4000. When 4000 score done ( all blocks destroy). The game will end and an congratulation window come like a pop-up with the a joyful sound and the congratulation emoji's come from the both side screen. Now add when the ball hit the block. A click sound come and when the vall fell off the peddle a fell and lose sound will come. Add a preloader for this This preloader have a sound effect of loading. In hte preloader a logo. below that logo a title " Ping Pong Ball" ASnd under that a loading come it should animated under loading bar presentage show !
/****
* Classes
****/
var HomeScreen = Container.expand(function () {
var self = Container.call(this);
// Background
var background = self.attachAsset('homeBackground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
});
// Title
var title = new Text2('Ping Pong Ball', {
size: 100,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
self.addChild(title);
// Developer info button (person logo)
var developerBtn = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
x: 1800,
y: 200,
scaleX: 0.5,
scaleY: 0.5
});
var developerText = new Text2('👤', {
size: 40,
fill: 0xFFFFFF
});
developerText.anchor.set(0.5, 0.5);
developerText.x = 1800;
developerText.y = 200;
self.addChild(developerText);
// Difficulty buttons
var easyBtn = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 800
});
var easyText = new Text2('EASY', {
size: 40,
fill: 0xFFFFFF
});
easyText.anchor.set(0.5, 0.5);
easyText.x = 1024;
easyText.y = 800;
self.addChild(easyText);
var mediumBtn = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 900
});
var mediumText = new Text2('MEDIUM', {
size: 40,
fill: 0xFFFFFF
});
mediumText.anchor.set(0.5, 0.5);
mediumText.x = 1024;
mediumText.y = 900;
self.addChild(mediumText);
var hardBtn = self.attachAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1000
});
var hardText = new Text2('HARD', {
size: 40,
fill: 0xFFFFFF
});
hardText.anchor.set(0.5, 0.5);
hardText.x = 1024;
hardText.y = 1000;
self.addChild(hardText);
// Add click handlers for difficulty buttons
easyBtn.down = function (x, y, obj) {
selectedDifficulty = 'easy';
gameState = 'playing';
playerName = 'Player';
homeScreen.destroy();
startGame();
};
mediumBtn.down = function (x, y, obj) {
selectedDifficulty = 'medium';
gameState = 'playing';
playerName = 'Player';
homeScreen.destroy();
startGame();
};
hardBtn.down = function (x, y, obj) {
selectedDifficulty = 'hard';
gameState = 'playing';
playerName = 'Player';
homeScreen.destroy();
startGame();
};
// Add click handler for developer info button
developerBtn.down = function (x, y, obj) {
showDeveloperPopup();
};
return self;
});
// Game states
var Preloader = Container.expand(function () {
var self = Container.call(this);
// Logo
var logo = self.attachAsset('preloaderLogo', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 800
});
// Title
var title = new Text2('Ping Pong Ball', {
size: 80,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 1000;
self.addChild(title);
// Loading bar background
var loadingBarBg = self.attachAsset('loadingBarBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200
});
// Loading bar fill
var loadingBarFill = self.attachAsset('loadingBarFill', {
anchorX: 0,
anchorY: 0.5,
x: 824,
y: 1200,
scaleX: 0
});
// Percentage text
var percentageText = new Text2('0%', {
size: 40,
fill: 0xFFFFFF
});
percentageText.anchor.set(0.5, 0.5);
percentageText.x = 1024;
percentageText.y = 1300;
self.addChild(percentageText);
self.progress = 0;
self.targetProgress = 0;
self.setProgress = function (percent) {
self.targetProgress = percent;
};
self.update = function () {
if (self.progress < self.targetProgress) {
self.progress += 2;
if (self.progress > self.targetProgress) {
self.progress = self.targetProgress;
}
loadingBarFill.scaleX = self.progress / 100;
percentageText.setText(Math.floor(self.progress) + '%');
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Sound effects
// Game Assets
// Preloader Assets
// Game states
var gameState = 'preloader'; // preloader, home, playing, gameOver, victory
var selectedDifficulty = 'easy';
var playerName = '';
var loadingProgress = 0;
// UI elements
var preloader = null;
var homeScreen = null;
// Initialize preloader
if (gameState === 'preloader') {
preloader = game.addChild(new Preloader());
LK.getSound('loadingSound').play();
// Simulate loading progress
var loadingTimer = LK.setInterval(function () {
loadingProgress += 5;
preloader.setProgress(loadingProgress);
if (loadingProgress >= 100) {
LK.clearInterval(loadingTimer);
// Transition to home screen after loading
LK.setTimeout(function () {
gameState = 'home';
preloader.destroy();
homeScreen = game.addChild(new HomeScreen());
// Start background music after loading completes
LK.playMusic('all');
}, 500);
}
}, 100);
}
// Developer info popup
function showDeveloperPopup() {
var devPopup = game.addChild(LK.getAsset('popup', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 1.5,
scaleY: 1.2
}));
var gameTitle = new Text2('Ping Pong Ball', {
size: 60,
fill: 0xFFFFFF
});
gameTitle.anchor.set(0.5, 0.5);
gameTitle.x = 1024;
gameTitle.y = 1150;
game.addChild(gameTitle);
var noteText = new Text2('This game is built by a student so if you feel any bug\nand glitch or issue. Please tell me. I will fix it\nas soon as possible. Thank You', {
size: 30,
fill: 0xFFFFFF
});
noteText.anchor.set(0.5, 0.5);
noteText.x = 1024;
noteText.y = 1280;
game.addChild(noteText);
var emailBtn = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1400,
scaleX: 0.8,
scaleY: 0.8
}));
var emailText = new Text2('[email protected]', {
size: 25,
fill: 0xFFFFFF
});
emailText.anchor.set(0.5, 0.5);
emailText.x = 1024;
emailText.y = 1400;
game.addChild(emailText);
var madeByText = new Text2('Made by Mohit Dudi', {
size: 30,
fill: 0xFFFFFF
});
madeByText.anchor.set(0.5, 0.5);
madeByText.x = 1024;
madeByText.y = 1480;
game.addChild(madeByText);
var copyrightText = new Text2('All copyright 2025 reserved by mohit dudi', {
size: 25,
fill: 0xFFFFFF
});
copyrightText.anchor.set(0.5, 0.5);
copyrightText.x = 1024;
copyrightText.y = 1520;
game.addChild(copyrightText);
// Close button
var closeBtn = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1580,
scaleX: 0.6,
scaleY: 0.6
}));
closeBtn.tint = 0xff4444;
var closeText = new Text2('CLOSE', {
size: 30,
fill: 0xFFFFFF
});
closeText.anchor.set(0.5, 0.5);
closeText.x = 1024;
closeText.y = 1580;
game.addChild(closeText);
// Close popup when clicking close button
closeBtn.down = function (x, y, obj) {
devPopup.destroy();
gameTitle.destroy();
noteText.destroy();
emailBtn.destroy();
emailText.destroy();
madeByText.destroy();
copyrightText.destroy();
closeBtn.destroy();
closeText.destroy();
};
}
// Start game function
function startGame() {
// Clear any existing game elements
game.removeChildren();
// Add game background
var gameBackground = game.addChild(LK.getAsset('gameBackground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
// Game variables
var ball = null;
var paddle = null;
var blocks = [];
var ballSpeedX = 3;
var ballSpeedY = 3;
var score = 0;
var lives = 3;
// Adjust difficulty
if (selectedDifficulty === 'easy') {
ballSpeedX = 4;
ballSpeedY = 4;
} else if (selectedDifficulty === 'medium') {
ballSpeedX = 7;
ballSpeedY = 7;
} else if (selectedDifficulty === 'hard') {
ballSpeedX = 12;
ballSpeedY = 12;
}
// Create ball
ball = game.addChild(LK.getAsset('ball', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1400
}));
// Create paddle
paddle = game.addChild(LK.getAsset('paddle', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2500
}));
// Create blocks
for (var row = 0; row < 8; row++) {
for (var col = 0; col < 12; col++) {
var block = game.addChild(LK.getAsset('block', {
anchorX: 0.5,
anchorY: 0.5,
x: 320 + col * 120,
y: 300 + row * 50
}));
blocks.push(block);
}
}
// Score display
var scoreText = new Text2('Score: 0', {
size: 40,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
scoreText.x = 100;
scoreText.y = 100;
game.addChild(scoreText);
// Lives display
var livesText = new Text2('Lives: 3', {
size: 40,
fill: 0xFFFFFF
});
livesText.anchor.set(1, 0);
livesText.x = 1900;
livesText.y = 100;
game.addChild(livesText);
// Home button
var homeBtn = game.addChild(LK.getAsset('button', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 200,
scaleX: 0.6,
scaleY: 0.6
}));
var homeText = new Text2('HOME', {
size: 30,
fill: 0xFFFFFF
});
homeText.anchor.set(0.5, 0.5);
homeText.x = 1024;
homeText.y = 200;
game.addChild(homeText);
// Home button click handler
homeBtn.down = function (x, y, obj) {
gameState = 'home';
game.removeChildren();
homeScreen = game.addChild(new HomeScreen());
};
// Game controls
game.move = function (x, y, obj) {
if (paddle) {
paddle.x = x;
// Keep paddle within screen bounds
if (paddle.x < 100) paddle.x = 100;
if (paddle.x > 1948) paddle.x = 1948;
}
};
// Game update function
var gameUpdate = function gameUpdate() {
if (!ball || !paddle) return;
// Move ball
ball.x += ballSpeedX;
ball.y += ballSpeedY;
// Ball collision with walls
if (ball.x <= 10 || ball.x >= 2038) {
ballSpeedX = -ballSpeedX;
}
if (ball.y <= 10) {
ballSpeedY = -ballSpeedY;
}
// Ball collision with paddle
if (ball.intersects(paddle) && ballSpeedY > 0) {
ballSpeedY = -ballSpeedY;
// Add some angle based on where ball hits paddle
var hitPos = (ball.x - paddle.x) / 100;
ballSpeedX += hitPos;
}
// Ball collision with blocks
for (var i = blocks.length - 1; i >= 0; i--) {
if (ball.intersects(blocks[i])) {
blocks[i].destroy();
blocks.splice(i, 1);
ballSpeedY = -ballSpeedY;
score += 10;
scoreText.setText('Score: ' + score);
break;
}
}
// Ball falls off screen
if (ball.y > 2732) {
lives--;
livesText.setText('Lives: ' + lives);
if (lives <= 0) {
// Game over
gameState = 'gameOver';
LK.showGameOver();
} else {
// Reset ball position
ball.x = 1024;
ball.y = 1400;
ballSpeedX = Math.abs(ballSpeedX);
ballSpeedY = Math.abs(ballSpeedY);
}
}
// Check win condition
if (blocks.length === 0) {
gameState = 'victory';
LK.showYouWin();
}
};
// Replace the main game update with our game logic
game.update = gameUpdate;
console.log('Game started with difficulty:', selectedDifficulty, 'and player name:', playerName);
}
// Game update loop
game.update = function () {
// Handle different game states
if (gameState === 'preloader') {
// Preloader updates automatically
} else if (gameState === 'home') {
// Home screen is static, waiting for user input
}
// Additional game states will be handled here
}; ===================================================================
--- original.js
+++ change.js
@@ -203,8 +203,10 @@
LK.setTimeout(function () {
gameState = 'home';
preloader.destroy();
homeScreen = game.addChild(new HomeScreen());
+ // Start background music after loading completes
+ LK.playMusic('all');
}, 500);
}
}, 100);
}
i want a try or peddle block image texute is robotic. In-Game asset. 2d. High contrast. No shadows
i want a fanshics ball for that showd show that textutrd snf motr frdign. In-Game asset. 2d. High contrast. No shadows
i want a transprant desinging block coliour full. In-Game asset. 2d. High contrast. No shadows