User prompt
backgroundu ortala
User prompt
oyuna background ekle
User prompt
ekranin en sağina top değerse puan eklesin
User prompt
top deliği geçtiğinde ve sağ tarafa değdiğinde puan artsin puan sesi gelsin ve deliğin yeri değişsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
deliği geçtiğinde yaptiğimiz puan alma sistemi geri gelsin
User prompt
ball cant passtrough on hole
User prompt
deliğin yerini düzelt ve çok az büyült
User prompt
duvarin yerini biraz sağa al
User prompt
top deliğe giremiyor duvar engelliyo olabilir düzet
User prompt
top deliğe girmiyor düzelt
User prompt
gorsellerin boyutlarini hitboxlara gore düzelt
User prompt
duvari güzel bir şekilde yerleştir
User prompt
duvarin boyutunu değiştir ve düzgün şekilde gozüksün
User prompt
duvarin boyunu düzgün ayarla
User prompt
müzik olsun
User prompt
delikte 3 kat büyüsün
User prompt
3 kat daha büyük olsun top
User prompt
top daha büyük olsun
User prompt
puan aldıktan sonra oyun yavaşliyo düzelt 1. bolümdekiyle ayni olsun
User prompt
düzelmedi
User prompt
topu hizlandirdiğinda sol tikla deliğe dokunduğunda puan vermiyor
User prompt
1 puan aldiktan sonra topun hizi yavaşliyo
User prompt
bu friction effect olduğunda çok hizli hareket ediyo top ve çok fazla o yonde gidiyo top sağ doğru gitsin ama yukarı aşağı eğimi az alsın
User prompt
pingo çubuğumuz tam topa değerken bir yone hareket ederse top o yone doğru gitsin sürtünmeyle
User prompt
sol tıkla hizlandirmaya bastiğimda top hareket etmeyi kesiyo bu bugu düzelt
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 24;
self.velocityY = 12;
self.baseSpeed = 24;
self.reset = function () {
self.x = 200;
self.y = 2732 / 2;
self.velocityX = self.baseSpeed;
self.velocityY = (Math.random() - 0.5) * 18;
self.lastX = self.x; // Initialize last position
};
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
// Bounce off top and bottom walls
if (self.y <= 15 || self.y >= 2732 - 15) {
self.velocityY = -self.velocityY;
LK.getSound('bounce').play();
}
// Game over if ball hits left wall
if (self.x <= 15) {
LK.showGameOver();
}
// Check paddle collision - both intersection and position crossing
var paddleLeft = paddle.x - 10; // paddle half-width
var paddleRight = paddle.x + 10; // paddle half-width
var paddleTop = paddle.y - 100; // paddle half-height
var paddleBottom = paddle.y + 100; // paddle half-height
var ballInPaddleY = self.y >= paddleTop && self.y <= paddleBottom;
var ballCrossedPaddle = self.lastX > paddleRight && self.x <= paddleRight;
if (self.velocityX < 0 && ballInPaddleY && (self.intersects(paddle) || ballCrossedPaddle)) {
self.velocityX = -self.velocityX;
// Add some angle based on where it hits the paddle
var paddleCenter = paddle.y;
var ballCenter = self.y;
var diff = ballCenter - paddleCenter;
self.velocityY += diff * 0.05;
// Add friction effect based on paddle movement
var paddleVelocity = paddle.targetY - paddle.y;
self.velocityY += paddleVelocity * 0.08; // Apply reduced friction effect
LK.getSound('bounce').play();
}
// Store last position for next frame collision detection
self.lastX = self.x;
// Reset if ball goes off right side
if (self.x > 2048 + 50) {
self.reset();
}
};
return self;
});
var Paddle = Container.expand(function () {
var self = Container.call(this);
var paddleGraphics = self.attachAsset('paddle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 12;
self.targetY = 2732 / 2;
self.update = function () {
var diff = self.targetY - self.y;
if (Math.abs(diff) > 2) {
self.y += diff * 0.15;
}
};
return self;
});
var Wall = Container.expand(function () {
var self = Container.call(this);
var wallGraphics = self.attachAsset('wall', {
anchorX: 0,
anchorY: 0
});
var holeGraphics = self.attachAsset('hole', {
anchorX: 0,
anchorY: 0.5
});
self.holeY = 2732 / 2;
holeGraphics.y = self.holeY;
self.moveHole = function () {
var minY = 100;
var maxY = 2732 - 100;
self.holeY = minY + Math.random() * (maxY - minY);
tween(holeGraphics, {
y: self.holeY
}, {
duration: 500,
easing: tween.easeOut
});
};
self.checkBallThrough = function (ball) {
var holeX = self.x;
var holeY = self.holeY;
var ballX = ball.x;
var ballY = ball.y;
var lastBallX = ball.lastX || ballX;
// Check if ball crossed through the wall horizontally
var crossedWall = lastBallX < holeX && ballX >= holeX;
// Check if ball was in hole Y range during the crossing
var inHoleY = Math.abs(ballY - holeY) < 60; // Half hole height
// Also check if ball is currently in the rectangular hole area (for slower speeds)
var inHoleX = ballX > holeX && ballX < holeX + 40; // Full wall width
var currentlyInHole = inHoleY && inHoleX;
return crossedWall && inHoleY || currentlyInHole;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x001122
});
/****
* Game Code
****/
var paddle = game.addChild(new Paddle());
paddle.x = 100;
paddle.y = 2732 / 2;
var ball = game.addChild(new Ball());
ball.reset();
var wall = game.addChild(new Wall());
wall.x = 2048 - 40;
wall.y = 0;
var scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 50;
var lastBallX = ball.x;
var ballThroughHole = false;
var isLeftPressed = false;
var originalSpeedX = 0;
var originalSpeedY = 0;
game.move = function (x, y, obj) {
paddle.targetY = y;
};
game.down = function (x, y, obj) {
paddle.targetY = y;
// Apply speed boost on any screen press
isLeftPressed = true;
// Store original speeds
originalSpeedX = ball.velocityX;
originalSpeedY = ball.velocityY;
// Boost ball speed 3x
ball.velocityX *= 3;
ball.velocityY *= 3;
};
game.up = function (x, y, obj) {
// Restore original speed on any screen release
if (isLeftPressed) {
isLeftPressed = false;
ball.velocityX /= 3;
ball.velocityY /= 3;
}
};
game.update = function () {
// Track ball movement for hole detection
var currentBallX = ball.x;
// Check if ball passed through hole
if (!ballThroughHole && wall.checkBallThrough(ball)) {
// Score!
ballThroughHole = true;
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
LK.getSound('score').play();
// Move hole to new position
wall.moveHole();
// Increase ball speed slightly
ball.baseSpeed += 0.5;
// Preserve current velocity and just increase it proportionally
var currentSpeed = Math.sqrt(ball.velocityX * ball.velocityX + ball.velocityY * ball.velocityY);
var speedIncrease = ball.baseSpeed / (ball.baseSpeed - 0.5);
ball.velocityX *= speedIncrease;
ball.velocityY *= speedIncrease;
} else if (!ballThroughHole && lastBallX < wall.x && currentBallX >= wall.x) {
// Ball hit the wall, bounce back
ball.velocityX = -ball.velocityX;
LK.getSound('bounce').play();
}
// Reset ball through hole flag when ball moves away
if (currentBallX < wall.x - 100) {
ballThroughHole = false;
}
lastBallX = currentBallX;
}; ===================================================================
--- original.js
+++ change.js