User prompt
hayır kartları küçült ben bir kartın üzerine tıklamazsam ama mouseyi üstüne getirirsem büyüsün diyerleri küçülsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
https://upit.com/create/assets/sound/68761e2dd236459bd9516417 bu ses özellik seçtiğimizde çıksın ve kartın üztüne geldiğimizde kart büyüsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kartlartı biraz küçült
User prompt
kaleyide biraz ileri al kartları daa
User prompt
benim kalemi ve evleri biraz ileri al
User prompt
kartları biraz büyüt ve alta al
User prompt
meselsa patlama yada delme özelliği bana iölemiyor eğer rakip delme patlaama özelliklerini kullanırsa beni etkilesin ama ben kullanırsam onu etkilerinsadwads
User prompt
rakip hamleleri mantıklı yapsından kastım mesela top kalesine çarpmak üzereyse topu yavaşlatsın yada eğer sayıoya ihtiyacı varsa ve top bana yaklaşmışsa delmeyi kullansın yada sayı almak için top bana gelirken yetişemem için hızlamdırsın yada top bana gelirken patlama yı kullansın
User prompt
ai ın kartlarına biz dokunamayalım ve ai yerinde hamleler yapsın ve aı nin kartlarını sakla ve ai yerinde mantıklı hamleler yapsın
User prompt
rakipte bu özellikleri kullana bilsin
User prompt
iki tane hızlanma kartı var birini kaldıer
User prompt
delme özelliğinin uzuznluğu 3 saniye 3 saniye sonunda top eski haline dönsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kartları biraz alta al
User prompt
kartları sola kot üst üste dursunlar
User prompt
patlama özelliğine basınca top nerede olursa olsun rakip hareket edemesin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
başlangıca hangi özelliğin ne işe yaradığının yazdığı bir tutorial koy inglizce olsu
User prompt
hızlanmada özelliğinde animasyondaa arkasından şimşek tarzı şeyler çıksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
delme iözelliği 3 saniye sonra bitsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
delme özelliğinin süresi 3 saniye olsuj ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kartların üzerine emoji koy özelliğe göre ve animasyonları aşırı güzel yap oynayan kişiyi içine çeksim ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
oyuna kartlar ekleyelim soldaki evlerin üztüne 5 tane kart koy bunlardan 1. top hızlandırıcı buna tıklarsak top hızlanır 5 saniye ve animasyonunuda yap yani hızlanma animasyonunu 2. cisi patlama top bi anda patlar ve eğer karşı rakip kalenin yakınındaysa rakip 5 saniye hareket edemez bu patlamanın da animasyonunu yap 3. delme eğer bunu kullanırsak top rakip çubuğa deyse bile içinden geçer 4. yavaşlama eğer bunu kullanırsak top 5 saniyeliğine yavaçlar sonra eski hızına döner yavaşlama animayonunuda yap ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
sadece kaybeden tarafın evleri yıkılsın ve karşı tarafın kelsinin rengi aynı kalsın ancak bizimki mavi olsun evlerle birlikte ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
oyun bitince oyun bitti elranı gelmeden ince velerin ve kalenin kırıldığını görelim ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
evlerin arasında boşluk olsun
User prompt
evklerin boyunu biraz büyüt
/**** * 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 = 0; self.velocityY = 0; self.speed = 12; self.reset = function () { self.x = 1024; self.y = 1366; var angle = (Math.random() > 0.5 ? 1 : -1) * (Math.PI / 6 + Math.random() * Math.PI / 3); self.velocityX = Math.sin(angle) * self.speed; self.velocityY = Math.cos(angle) * self.speed * (Math.random() > 0.5 ? 1 : -1); }; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; // Bounce off left and right walls if (self.x <= 30 || self.x >= 2018) { self.velocityX = -self.velocityX; } }; return self; }); var Card = Container.expand(function (cardType) { var self = Container.call(this); var cardGraphics = self.attachAsset('card', { anchorX: 0.5, anchorY: 0.5 }); self.cardType = cardType; self.used = false; self.cooldown = 0; var iconAsset = ''; switch (cardType) { case 'speed': iconAsset = 'speedBoostIcon'; break; case 'explosion': iconAsset = 'explosionIcon'; break; case 'pierce': iconAsset = 'pierceIcon'; break; case 'slow': iconAsset = 'slowIcon'; break; } var icon = self.attachAsset(iconAsset, { anchorX: 0.5, anchorY: 0.5 }); self.down = function (x, y, obj) { if (!self.used && self.cooldown <= 0) { self.used = true; self.cooldown = 300; // 5 seconds at 60fps cardGraphics.alpha = 0.5; icon.alpha = 0.5; switch (self.cardType) { case 'speed': activateSpeedBoost(); break; case 'explosion': activateExplosion(); break; case 'pierce': activatePierce(); break; case 'slow': activateSlow(); break; } } }; self.update = function () { if (self.cooldown > 0) { self.cooldown--; if (self.cooldown <= 0) { self.used = false; cardGraphics.alpha = 1; icon.alpha = 1; } } }; return self; }); var Castle = Container.expand(function () { var self = Container.call(this); var castleGraphics = self.attachAsset('castle', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var House = Container.expand(function () { var self = Container.call(this); var houseGraphics = self.attachAsset('house', { anchorX: 0.5, anchorY: 0.5 }); 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 = 8; self.targetX = self.x; self.moveTowards = function (targetX) { self.targetX = targetX; if (self.targetX < 100) self.targetX = 100; if (self.targetX > 1948) self.targetX = 1948; }; self.update = function () { if (Math.abs(self.x - self.targetX) > 2) { if (self.x < self.targetX) { self.x += self.speed; } else { self.x -= self.speed; } } }; return self; }); var Particle = Container.expand(function () { var self = Container.call(this); var particleGraphics = self.attachAsset('particle', { anchorX: 0.5, anchorY: 0.5 }); self.velocityX = (Math.random() - 0.5) * 8; self.velocityY = (Math.random() - 0.5) * 8; self.life = 30; self.maxLife = 30; self.update = function () { self.x += self.velocityX; self.y += self.velocityY; self.life--; var alpha = self.life / self.maxLife; particleGraphics.alpha = alpha; if (self.life <= 0) { self.destroy(); particles.splice(particles.indexOf(self), 1); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x228B22 }); /**** * Game Code ****/ var gameTime = 90; var playerScore = 0; var aiScore = 0; var particles = []; var cards = []; var speedBoostActive = false; var speedBoostTimer = 0; var explosionActive = false; var pierceActive = false; var pierceTimer = 0; var slowActive = false; var slowTimer = 0; var aiStunned = false; var aiStunTimer = 0; // Create UI elements var timerText = new Text2('90', { size: 80, fill: 0xFFFFFF }); timerText.anchor.set(0.5, 0); LK.gui.top.addChild(timerText); var playerScoreText = new Text2('0', { size: 60, fill: 0x4A90E2 }); playerScoreText.anchor.set(0, 1); LK.gui.bottomLeft.addChild(playerScoreText); var aiScoreText = new Text2('0', { size: 60, fill: 0xE24A4A }); aiScoreText.anchor.set(0, 0); LK.gui.topLeft.addChild(aiScoreText); // Create game objects var playerPaddle = game.addChild(new Paddle()); playerPaddle.x = 1024; playerPaddle.y = 2400; var aiPaddle = game.addChild(new Paddle()); aiPaddle.x = 1024; aiPaddle.y = 332; var playerCastle = game.addChild(new Castle()); playerCastle.x = 1024; playerCastle.y = 2642; // Add houses around player castle // Left side houses in a row var playerHouse1L = game.addChild(new House()); playerHouse1L.x = 350; playerHouse1L.y = 2642; var playerHouse2L = game.addChild(new House()); playerHouse2L.x = 500; playerHouse2L.y = 2642; var playerHouse3L = game.addChild(new House()); playerHouse3L.x = 650; playerHouse3L.y = 2642; // Right side houses in a row var playerHouse1R = game.addChild(new House()); playerHouse1R.x = 1398; playerHouse1R.y = 2642; var playerHouse2R = game.addChild(new House()); playerHouse2R.x = 1548; playerHouse2R.y = 2642; var playerHouse3R = game.addChild(new House()); playerHouse3R.x = 1698; playerHouse3R.y = 2642; var aiCastle = game.addChild(new Castle()); aiCastle.x = 1024; aiCastle.y = 90; // Add houses around AI castle // Left side houses in a row var aiHouse1L = game.addChild(new House()); aiHouse1L.x = 350; aiHouse1L.y = 90; var aiHouse2L = game.addChild(new House()); aiHouse2L.x = 500; aiHouse2L.y = 90; var aiHouse3L = game.addChild(new House()); aiHouse3L.x = 650; aiHouse3L.y = 90; // Right side houses in a row var aiHouse1R = game.addChild(new House()); aiHouse1R.x = 1398; aiHouse1R.y = 90; var aiHouse2R = game.addChild(new House()); aiHouse2R.x = 1548; aiHouse2R.y = 90; var aiHouse3R = game.addChild(new House()); aiHouse3R.x = 1698; aiHouse3R.y = 90; // Add field details var ball = game.addChild(new Ball()); ball.reset(); // Create cards above left side houses var cardTypes = ['speed', 'explosion', 'pierce', 'slow', 'speed']; var cardPositions = [300, 425, 550, 675, 800]; for (var i = 0; i < 5; i++) { var card = game.addChild(new Card(cardTypes[i])); card.x = cardPositions[i]; card.y = 2500; cards.push(card); } function destroyBuildings() { // Determine which side lost and which buildings to destroy var losingBuildings = []; var winningCastle = null; var winningHouses = []; if (playerScore > aiScore) { // Player won, destroy AI buildings losingBuildings = [aiCastle, aiHouse1L, aiHouse2L, aiHouse3L, aiHouse1R, aiHouse2R, aiHouse3R]; winningCastle = playerCastle; winningHouses = [playerHouse1L, playerHouse2L, playerHouse3L, playerHouse1R, playerHouse2R, playerHouse3R]; } else { // AI won, destroy player buildings losingBuildings = [playerCastle, playerHouse1L, playerHouse2L, playerHouse3L, playerHouse1R, playerHouse2R, playerHouse3R]; winningCastle = aiCastle; winningHouses = [aiHouse1L, aiHouse2L, aiHouse3L, aiHouse1R, aiHouse2R, aiHouse3R]; } // Apply blue tint to winning castle and houses if (winningCastle) { tween(winningCastle, { tint: 0x4A90E2 }, { duration: 500, easing: tween.easeOut }); } for (var j = 0; j < winningHouses.length; j++) { tween(winningHouses[j], { tint: 0x4A90E2 }, { duration: 500, easing: tween.easeOut }); } // Destroy losing buildings with staggered timing for (var i = 0; i < losingBuildings.length; i++) { var building = losingBuildings[i]; var delay = i * 100; // 100ms delay between each building LK.setTimeout(function (currentBuilding) { return function () { // Create explosion effect at building location createExplosionEffect(currentBuilding.x, currentBuilding.y); // Animate building destruction tween(currentBuilding, { alpha: 0, scaleX: 0.3, scaleY: 0.3, rotation: Math.random() * 0.5 - 0.25 }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { currentBuilding.visible = false; } }); }; }(building), delay); } } var gameTimer = LK.setInterval(function () { gameTime--; timerText.setText(gameTime.toString()); if (gameTime <= 0) { LK.clearInterval(gameTimer); // Start destruction animation before showing game over destroyBuildings(); // Show game over after destruction animation completes LK.setTimeout(function () { if (playerScore > aiScore) { LK.showYouWin(); } else { LK.showGameOver(); } }, 2000); // Wait 2 seconds for destruction animation to complete } }, 1000); var touchX = 1024; function createParticles(x, y) { for (var i = 0; i < 8; i++) { var particle = game.addChild(new Particle()); particle.x = x; particle.y = y; particles.push(particle); } } function activateSpeedBoost() { speedBoostActive = true; speedBoostTimer = 300; // 5 seconds at 60fps ball.speed = 18; // Speed boost animation tween(ball, { tint: 0xFFFF00 }, { duration: 200 }); tween(ball, { scaleX: 1.2, scaleY: 1.2 }, { duration: 200, easing: tween.easeOut }); } function activateExplosion() { explosionActive = true; // Create explosion at ball position createExplosionEffect(ball.x, ball.y); // Check if ball is near AI castle area if (ball.y <= 400) { aiStunned = true; aiStunTimer = 300; // 5 seconds at 60fps // Visual effect for stunned AI tween(aiPaddle, { tint: 0xFF0000 }, { duration: 100 }); } } function activatePierce() { pierceActive = true; pierceTimer = 300; // 5 seconds at 60fps // Pierce animation tween(ball, { tint: 0x44FF44 }, { duration: 200 }); } function activateSlow() { slowActive = true; slowTimer = 300; // 5 seconds at 60fps ball.speed = 6; // Slow animation tween(ball, { tint: 0x4444FF }, { duration: 200 }); tween(ball, { scaleX: 0.8, scaleY: 0.8 }, { duration: 200, easing: tween.easeOut }); } function createExplosionEffect(x, y) { // Create screen shake effect var originalX = game.x; var originalY = game.y; tween(game, { x: originalX + 10, y: originalY + 10 }, { duration: 50, onFinish: function onFinish() { tween(game, { x: originalX - 10, y: originalY - 10 }, { duration: 50, onFinish: function onFinish() { tween(game, { x: originalX, y: originalY }, { duration: 50 }); } }); } }); // Create explosion particles with color variations for (var i = 0; i < 15; i++) { var particle = game.addChild(new Particle()); particle.x = x + (Math.random() - 0.5) * 120; particle.y = y + (Math.random() - 0.5) * 120; particle.velocityX = (Math.random() - 0.5) * 15; particle.velocityY = (Math.random() - 0.5) * 15; particle.life = 40; particle.maxLife = 40; // Add color tinting with tween var colors = [0xff4444, 0xffaa44, 0xffff44, 0xff8844]; var randomColor = colors[Math.floor(Math.random() * colors.length)]; tween(particle, { tint: randomColor }, { duration: 200 }); particles.push(particle); } } function checkPaddleCollision(paddle, ball) { var paddleLeft = paddle.x - 100; var paddleRight = paddle.x + 100; var paddleTop = paddle.y - 20; var paddleBottom = paddle.y + 20; var ballLeft = ball.x - 30; var ballRight = ball.x + 30; var ballTop = ball.y - 30; var ballBottom = ball.y + 30; return ballRight > paddleLeft && ballLeft < paddleRight && ballBottom > paddleTop && ballTop < paddleBottom; } game.down = function (x, y, obj) { touchX = x; playerPaddle.moveTowards(x); }; game.move = function (x, y, obj) { touchX = x; playerPaddle.moveTowards(x); }; game.update = function () { // Handle power-up timers if (speedBoostActive) { speedBoostTimer--; if (speedBoostTimer <= 0) { speedBoostActive = false; ball.speed = 12; tween(ball, { tint: 0xFFFFFF }, { duration: 200 }); tween(ball, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); } } if (slowActive) { slowTimer--; if (slowTimer <= 0) { slowActive = false; ball.speed = 12; tween(ball, { tint: 0xFFFFFF }, { duration: 200 }); tween(ball, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeOut }); } } if (pierceActive) { pierceTimer--; if (pierceTimer <= 0) { pierceActive = false; tween(ball, { tint: 0xFFFFFF }, { duration: 200 }); } } if (aiStunned) { aiStunTimer--; if (aiStunTimer <= 0) { aiStunned = false; tween(aiPaddle, { tint: 0xFFFFFF }, { duration: 200 }); } } // AI paddle follows ball with some delay (unless stunned) if (!aiStunned) { var targetX = ball.x + ball.velocityX * 10; if (targetX < 100) targetX = 100; if (targetX > 1948) targetX = 1948; aiPaddle.moveTowards(targetX); } // Check paddle collisions if (checkPaddleCollision(playerPaddle, ball)) { if (ball.velocityY > 0) { ball.velocityY = -ball.velocityY; var hitOffset = (ball.x - playerPaddle.x) / 100; ball.velocityX += hitOffset * 2; createParticles(ball.x, ball.y); LK.getSound('paddleHit').play(); } } if (checkPaddleCollision(aiPaddle, ball) && !pierceActive) { if (ball.velocityY < 0) { ball.velocityY = -ball.velocityY; var hitOffset = (ball.x - aiPaddle.x) / 100; ball.velocityX += hitOffset * 2; createParticles(ball.x, ball.y); LK.getSound('paddleHit').play(); } } // Check goal scoring if (ball.y < 0) { playerScore++; playerScoreText.setText(playerScore.toString()); LK.setScore(playerScore); ball.reset(); LK.getSound('goal').play(); } if (ball.y > 2732) { aiScore++; aiScoreText.setText(aiScore.toString()); ball.reset(); LK.getSound('goal').play(); } // Check collision with castle areas to create explosion particles if (ball.y <= 180 && ball.y >= 0 && ball.x >= 200 && ball.x <= 1848) { // Ball hit AI castle/houses area createExplosionEffect(ball.x, ball.y); } if (ball.y >= 2552 && ball.y <= 2732 && ball.x >= 200 && ball.x <= 1848) { // Ball hit player castle/houses area createExplosionEffect(ball.x, ball.y); } // Limit ball speed var maxSpeed = 12; var currentSpeed = Math.sqrt(ball.velocityX * ball.velocityX + ball.velocityY * ball.velocityY); if (currentSpeed > maxSpeed) { ball.velocityX = ball.velocityX / currentSpeed * maxSpeed; ball.velocityY = ball.velocityY / currentSpeed * maxSpeed; } };
===================================================================
--- original.js
+++ change.js
@@ -31,8 +31,70 @@
}
};
return self;
});
+var Card = Container.expand(function (cardType) {
+ var self = Container.call(this);
+ var cardGraphics = self.attachAsset('card', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.cardType = cardType;
+ self.used = false;
+ self.cooldown = 0;
+ var iconAsset = '';
+ switch (cardType) {
+ case 'speed':
+ iconAsset = 'speedBoostIcon';
+ break;
+ case 'explosion':
+ iconAsset = 'explosionIcon';
+ break;
+ case 'pierce':
+ iconAsset = 'pierceIcon';
+ break;
+ case 'slow':
+ iconAsset = 'slowIcon';
+ break;
+ }
+ var icon = self.attachAsset(iconAsset, {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.down = function (x, y, obj) {
+ if (!self.used && self.cooldown <= 0) {
+ self.used = true;
+ self.cooldown = 300; // 5 seconds at 60fps
+ cardGraphics.alpha = 0.5;
+ icon.alpha = 0.5;
+ switch (self.cardType) {
+ case 'speed':
+ activateSpeedBoost();
+ break;
+ case 'explosion':
+ activateExplosion();
+ break;
+ case 'pierce':
+ activatePierce();
+ break;
+ case 'slow':
+ activateSlow();
+ break;
+ }
+ }
+ };
+ self.update = function () {
+ if (self.cooldown > 0) {
+ self.cooldown--;
+ if (self.cooldown <= 0) {
+ self.used = false;
+ cardGraphics.alpha = 1;
+ icon.alpha = 1;
+ }
+ }
+ };
+ return self;
+});
var Castle = Container.expand(function () {
var self = Container.call(this);
var castleGraphics = self.attachAsset('castle', {
anchorX: 0.5,
@@ -109,8 +171,18 @@
var gameTime = 90;
var playerScore = 0;
var aiScore = 0;
var particles = [];
+var cards = [];
+var speedBoostActive = false;
+var speedBoostTimer = 0;
+var explosionActive = false;
+var pierceActive = false;
+var pierceTimer = 0;
+var slowActive = false;
+var slowTimer = 0;
+var aiStunned = false;
+var aiStunTimer = 0;
// Create UI elements
var timerText = new Text2('90', {
size: 80,
fill: 0xFFFFFF
@@ -186,8 +258,17 @@
aiHouse3R.y = 90;
// Add field details
var ball = game.addChild(new Ball());
ball.reset();
+// Create cards above left side houses
+var cardTypes = ['speed', 'explosion', 'pierce', 'slow', 'speed'];
+var cardPositions = [300, 425, 550, 675, 800];
+for (var i = 0; i < 5; i++) {
+ var card = game.addChild(new Card(cardTypes[i]));
+ card.x = cardPositions[i];
+ card.y = 2500;
+ cards.push(card);
+}
function destroyBuildings() {
// Determine which side lost and which buildings to destroy
var losingBuildings = [];
var winningCastle = null;
@@ -270,8 +351,70 @@
particle.y = y;
particles.push(particle);
}
}
+function activateSpeedBoost() {
+ speedBoostActive = true;
+ speedBoostTimer = 300; // 5 seconds at 60fps
+ ball.speed = 18;
+ // Speed boost animation
+ tween(ball, {
+ tint: 0xFFFF00
+ }, {
+ duration: 200
+ });
+ tween(ball, {
+ scaleX: 1.2,
+ scaleY: 1.2
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+}
+function activateExplosion() {
+ explosionActive = true;
+ // Create explosion at ball position
+ createExplosionEffect(ball.x, ball.y);
+ // Check if ball is near AI castle area
+ if (ball.y <= 400) {
+ aiStunned = true;
+ aiStunTimer = 300; // 5 seconds at 60fps
+ // Visual effect for stunned AI
+ tween(aiPaddle, {
+ tint: 0xFF0000
+ }, {
+ duration: 100
+ });
+ }
+}
+function activatePierce() {
+ pierceActive = true;
+ pierceTimer = 300; // 5 seconds at 60fps
+ // Pierce animation
+ tween(ball, {
+ tint: 0x44FF44
+ }, {
+ duration: 200
+ });
+}
+function activateSlow() {
+ slowActive = true;
+ slowTimer = 300; // 5 seconds at 60fps
+ ball.speed = 6;
+ // Slow animation
+ tween(ball, {
+ tint: 0x4444FF
+ }, {
+ duration: 200
+ });
+ tween(ball, {
+ scaleX: 0.8,
+ scaleY: 0.8
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+}
function createExplosionEffect(x, y) {
// Create screen shake effect
var originalX = game.x;
var originalY = game.y;
@@ -336,13 +479,76 @@
touchX = x;
playerPaddle.moveTowards(x);
};
game.update = function () {
- // AI paddle follows ball with some delay
- var targetX = ball.x + ball.velocityX * 10;
- if (targetX < 100) targetX = 100;
- if (targetX > 1948) targetX = 1948;
- aiPaddle.moveTowards(targetX);
+ // Handle power-up timers
+ if (speedBoostActive) {
+ speedBoostTimer--;
+ if (speedBoostTimer <= 0) {
+ speedBoostActive = false;
+ ball.speed = 12;
+ tween(ball, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 200
+ });
+ tween(ball, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+ }
+ }
+ if (slowActive) {
+ slowTimer--;
+ if (slowTimer <= 0) {
+ slowActive = false;
+ ball.speed = 12;
+ tween(ball, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 200
+ });
+ tween(ball, {
+ scaleX: 1,
+ scaleY: 1
+ }, {
+ duration: 200,
+ easing: tween.easeOut
+ });
+ }
+ }
+ if (pierceActive) {
+ pierceTimer--;
+ if (pierceTimer <= 0) {
+ pierceActive = false;
+ tween(ball, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 200
+ });
+ }
+ }
+ if (aiStunned) {
+ aiStunTimer--;
+ if (aiStunTimer <= 0) {
+ aiStunned = false;
+ tween(aiPaddle, {
+ tint: 0xFFFFFF
+ }, {
+ duration: 200
+ });
+ }
+ }
+ // AI paddle follows ball with some delay (unless stunned)
+ if (!aiStunned) {
+ var targetX = ball.x + ball.velocityX * 10;
+ if (targetX < 100) targetX = 100;
+ if (targetX > 1948) targetX = 1948;
+ aiPaddle.moveTowards(targetX);
+ }
// Check paddle collisions
if (checkPaddleCollision(playerPaddle, ball)) {
if (ball.velocityY > 0) {
ball.velocityY = -ball.velocityY;
@@ -351,9 +557,9 @@
createParticles(ball.x, ball.y);
LK.getSound('paddleHit').play();
}
}
- if (checkPaddleCollision(aiPaddle, ball)) {
+ if (checkPaddleCollision(aiPaddle, ball) && !pierceActive) {
if (ball.velocityY < 0) {
ball.velocityY = -ball.velocityY;
var hitOffset = (ball.x - aiPaddle.x) / 100;
ball.velocityX += hitOffset * 2;