User prompt
kalleci top atılınca takip etsin
User prompt
karşılıklı şut olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
topa vuran bir futbolcu olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
kalleci ileri geri saga sola hareketler yapsın
User prompt
top kalledeye girince yeni top gelsin
User prompt
seyirciler olsun
User prompt
alan cizgisi
User prompt
top hızı daha yüksek
User prompt
yatay olarak kullanım
User prompt
görüntü alana ortalansın
User prompt
alan tam gözüksün
Code edit (1 edits merged)
Please save this source code
User prompt
oyun alanı tam ekran
User prompt
top hızını arttır
User prompt
oyunalanı nı 90 derece cevir
User prompt
yukarıdan kontrol
User prompt
engelleri kaldır
User prompt
ouon alanı tam orda da olsun
User prompt
kallaci hızını düşür
User prompt
oyun hızı biraz daha düşük ve alan ortalı olsun
User prompt
ekranı daha büyük olsun ve start tuşu olsun engeller olsun oyunda
User prompt
daha gerçekci ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
alan da geniş olsun
User prompt
biraz daha büyük bit top
/**** * 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.gravity = 0.2; self.moving = false; self.update = function () { if (self.moving) { self.x += self.velocityX; self.y += self.velocityY; self.velocityY += self.gravity; // Ground collision if (self.y >= ballStartY) { self.y = ballStartY; self.velocityY *= -0.4; self.velocityX *= 0.8; // Add ground impact animation tween(ballGraphics, { scaleY: 0.8 }, { duration: 50, easing: tween.easeOut, onFinish: function onFinish() { tween(ballGraphics, { scaleY: 1.0 }, { duration: 100, easing: tween.bounceOut }); } }); if (Math.abs(self.velocityX) < 1 && Math.abs(self.velocityY) < 1) { self.moving = false; self.velocityX = 0; self.velocityY = 0; tween.stop(ballGraphics, { rotation: true }); } } } }; self.shoot = function (targetX, targetY, power) { var distance = Math.sqrt((targetX - self.x) * (targetX - self.x) + (targetY - self.y) * (targetY - self.y)); self.velocityX = (targetX - self.x) / distance * power; self.velocityY = (targetY - self.y) / distance * power; self.moving = true; // Add realistic ball spin during flight var spinSpeed = power * 0.3; tween(ballGraphics, { rotation: ballGraphics.rotation + spinSpeed }, { duration: 2000, easing: tween.linear }); // Add ball scale effect for power visualization tween(ballGraphics, { scaleX: 1.2, scaleY: 1.2 }, { duration: 100, easing: tween.easeOut, onFinish: function onFinish() { tween(ballGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeInOut }); } }); LK.getSound('kick').play(); }; return self; }); var Goalkeeper = Container.expand(function () { var self = Container.call(this); var keeperGraphics = self.attachAsset('goalkeeper', { anchorX: 0.5, anchorY: 1.0 }); self.speed = 1.0 + LK.getScore() * 0.3; self.direction = 1; self.reactionTime = 0; self.isDiving = false; self.maxReactionTime = 30 - LK.getScore() * 2; if (self.maxReactionTime < 10) { self.maxReactionTime = 10; } // Add realistic goalkeeper breathing animation tween(keeperGraphics, { scaleY: 1.1 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { tween(keeperGraphics, { scaleY: 1.0 }, { duration: 1000, easing: tween.easeInOut, onFinish: function onFinish() { // Repeat breathing animation LK.setTimeout(function () { if (!self.isDiving) { tween(keeperGraphics, { scaleY: 1.1 }, { duration: 1000, easing: tween.easeInOut }); } }, 500); } }); } }); self.update = function () { // Random movement when not diving if (!self.isDiving && Math.random() < 0.02) { self.direction *= -1; } if (!self.isDiving) { self.x += self.direction * self.speed; } // Keep within goal bounds if (self.x <= goalX + 50) { self.x = goalX + 50; self.direction = 1; } if (self.x >= goalX + goalWidth - 50) { self.x = goalX + goalWidth - 50; self.direction = -1; } // React to ball when it's moving toward goal if (ball.moving && ball.y < goalY + 100) { self.reactionTime++; if (self.reactionTime > self.maxReactionTime && !self.isDiving) { self.isDiving = true; var targetX = ball.x; // Dive animation with tween tween(self, { x: targetX, rotation: self.x < targetX ? 0.5 : -0.5 }, { duration: 600, easing: tween.easeOut, onFinish: function onFinish() { // Reset after dive LK.setTimeout(function () { self.isDiving = false; tween(self, { rotation: 0 }, { duration: 300, easing: tween.easeInOut }); }, 1000); } }); } } else { self.reactionTime = 0; } }; return self; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 1.0 }); self.update = function () { // Obstacles are static but can animate if (Math.random() < 0.01) { tween(obstacleGraphics, { scaleX: 1.1, scaleY: 1.1 }, { duration: 200, easing: tween.easeInOut, onFinish: function onFinish() { tween(obstacleGraphics, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200, easing: tween.easeInOut }); } }); } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB, width: 2560, height: 3200 }); /**** * Game Code ****/ // Game dimensions and positions var screenWidth = 2560; var screenHeight = 3200; var fieldY = screenHeight - 1000; // Move field up to center it better in the game area var goalWidth = 1200; var goalHeight = 500; var goalX = (screenWidth - goalWidth) / 2; var goalY = fieldY - goalHeight; var ballStartX = screenWidth / 2; var ballStartY = fieldY - 40; // Game state var isAiming = false; var aimStartX = 0; var aimStartY = 0; var gameState = 'waiting'; // 'waiting', 'ready', 'aiming', 'shooting', 'reset' var gameStarted = false; // Create field var field = game.addChild(LK.getAsset('field', { anchorX: 0.5, anchorY: 0, x: screenWidth / 2, y: fieldY, width: screenWidth, height: 1000 })); // Create goal var goal = game.addChild(LK.getAsset('goal', { anchorX: 0, anchorY: 0, x: goalX, y: goalY })); // Create goal posts (visual) var leftPost = game.addChild(LK.getAsset('aimLine', { anchorX: 0.5, anchorY: 0, x: goalX, y: goalY, width: 12, height: goalHeight, color: 0xffffff })); var rightPost = game.addChild(LK.getAsset('aimLine', { anchorX: 0.5, anchorY: 0, x: goalX + goalWidth, y: goalY, width: 12, height: goalHeight, color: 0xffffff })); var crossbar = game.addChild(LK.getAsset('aimLine', { anchorX: 0, anchorY: 0.5, x: goalX, y: goalY, width: goalWidth, height: 12, color: 0xffffff })); // Create ball var ball = game.addChild(new Ball()); ball.x = ballStartX; ball.y = ballStartY; // Create goalkeeper var goalkeeper = game.addChild(new Goalkeeper()); goalkeeper.x = goalX + goalWidth / 2; goalkeeper.y = goalY + goalHeight; // Create start button var startButton = game.addChild(LK.getAsset('startButton', { anchorX: 0.5, anchorY: 0.5, x: screenWidth / 2, y: screenHeight / 2 })); var startButtonText = new Text2('START GAME', { size: 50, fill: 0xFFFFFF }); startButtonText.anchor.set(0.5, 0.5); startButtonText.x = screenWidth / 2; startButtonText.y = screenHeight / 2; game.addChild(startButtonText); // Create obstacles array var obstacles = []; // Create obstacles positioned strategically var obstacle1 = game.addChild(new Obstacle()); obstacle1.x = goalX + goalWidth * 0.25; obstacle1.y = goalY + 50; obstacles.push(obstacle1); var obstacle2 = game.addChild(new Obstacle()); obstacle2.x = goalX + goalWidth * 0.75; obstacle2.y = goalY + 50; obstacles.push(obstacle2); var obstacle3 = game.addChild(new Obstacle()); obstacle3.x = screenWidth / 2; obstacle3.y = fieldY - 300; obstacles.push(obstacle3); // Hide game elements initially field.alpha = 0.3; goal.alpha = 0.3; leftPost.alpha = 0.3; rightPost.alpha = 0.3; crossbar.alpha = 0.3; ball.alpha = 0.3; goalkeeper.alpha = 0.3; for (var i = 0; i < obstacles.length; i++) { obstacles[i].alpha = 0.3; } // Create aim line (initially hidden) var aimLine = game.addChild(LK.getAsset('aimLine', { anchorX: 0, anchorY: 0.5, alpha: 0 })); // Create score display var scoreTxt = new Text2('Score: 0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create instruction text var instructionTxt = new Text2('Click START GAME to begin!', { size: 60, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 1); instructionTxt.y = -50; LK.gui.bottom.addChild(instructionTxt); // Game event handlers game.down = function (x, y, obj) { if (!gameStarted && gameState === 'waiting') { // Check if clicked on start button var buttonBounds = { left: screenWidth / 2 - 200, right: screenWidth / 2 + 200, top: screenHeight / 2 - 50, bottom: screenHeight / 2 + 50 }; if (x >= buttonBounds.left && x <= buttonBounds.right && y >= buttonBounds.top && y <= buttonBounds.bottom) { // Start the game gameStarted = true; gameState = 'ready'; // Hide start button startButton.alpha = 0; startButtonText.alpha = 0; // Show game elements field.alpha = 1; goal.alpha = 1; leftPost.alpha = 1; rightPost.alpha = 1; crossbar.alpha = 1; ball.alpha = 1; goalkeeper.alpha = 1; for (var i = 0; i < obstacles.length; i++) { obstacles[i].alpha = 1; } // Update instruction text instructionTxt.setText('Drag to aim, release to shoot!'); } } else if (gameState === 'ready') { gameState = 'aiming'; isAiming = true; aimStartX = x; aimStartY = y; aimLine.alpha = 1; } }; game.move = function (x, y, obj) { if (isAiming && gameState === 'aiming') { var dx = x - ball.x; var dy = y - ball.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { aimLine.x = ball.x; aimLine.y = ball.y; var targetWidth = Math.min(distance, 300); // Smooth aim line width transition tween(aimLine, { width: targetWidth }, { duration: 50, easing: tween.easeOut }); aimLine.rotation = Math.atan2(dy, dx); // Power visualization with color change var power = Math.min(distance / 300, 1); var red = Math.floor(255 * power); var green = Math.floor(255 * (1 - power)); var color = red << 16 | green << 8 | 0; tween(aimLine, { tint: color }, { duration: 100, easing: tween.linear }); } } }; game.up = function (x, y, obj) { if (isAiming && gameState === 'aiming') { isAiming = false; aimLine.alpha = 0; gameState = 'shooting'; var dx = x - ball.x; var dy = y - ball.y; var distance = Math.sqrt(dx * dx + dy * dy); var power = Math.min(distance / 10, 12); ball.shoot(x, y, power); } }; // Reset function function resetGame() { ball.x = ballStartX; ball.y = ballStartY; ball.moving = false; ball.velocityX = 0; ball.velocityY = 0; gameState = 'ready'; goalkeeper.reactionTime = 0; goalkeeper.speed = 1.0 + LK.getScore() * 0.3; goalkeeper.maxReactionTime = 30 - LK.getScore() * 2; if (goalkeeper.maxReactionTime < 10) { goalkeeper.maxReactionTime = 10; } } // Game update loop game.update = function () { // Check for goal if (ball.moving && ball.x > goalX && ball.x < goalX + goalWidth && ball.y > goalY && ball.y < goalY + goalHeight && ball.lastY !== undefined && ball.lastY >= goalY) { // Check if goalkeeper blocked it if (!ball.intersects(goalkeeper)) { LK.setScore(LK.getScore() + 1); scoreTxt.setText('Score: ' + LK.getScore()); LK.getSound('goal').play(); LK.effects.flashScreen(0x00ff00, 500); // Celebrate goal with ball bounce and goal shake tween(ball, { scaleX: 1.5, scaleY: 1.5 }, { duration: 300, easing: tween.bounceOut, onFinish: function onFinish() { tween(ball, { scaleX: 1.0, scaleY: 1.0 }, { duration: 200 }); } }); // Goal shake effect tween(goal, { x: goalX + 10 }, { duration: 50, easing: tween.easeInOut, onFinish: function onFinish() { tween(goal, { x: goalX - 10 }, { duration: 50, onFinish: function onFinish() { tween(goal, { x: goalX }, { duration: 50 }); } }); } }); // Score text celebration tween(scoreTxt, { scaleX: 1.3, scaleY: 1.3 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(scoreTxt, { scaleX: 1.0, scaleY: 1.0 }, { duration: 300 }); } }); LK.setTimeout(function () { resetGame(); }, 1500); } } // Check for goalkeeper block if (ball.moving && ball.intersects(goalkeeper)) { LK.getSound('block').play(); LK.effects.flashScreen(0xff0000, 500); LK.showGameOver(); } // Check for obstacle collisions for (var i = 0; i < obstacles.length; i++) { if (ball.moving && ball.intersects(obstacles[i])) { // Bounce off obstacle ball.velocityX *= -0.5; ball.velocityY *= -0.5; LK.getSound('block').play(); // Obstacle hit animation tween(obstacles[i], { scaleX: 1.3, scaleY: 1.3 }, { duration: 150, easing: tween.easeOut, onFinish: function onFinish() { tween(obstacles[i], { scaleX: 1.0, scaleY: 1.0 }, { duration: 150, easing: tween.easeInOut }); } }); break; } } // Check if ball went off screen or stopped moving for too long if (ball.moving && (ball.x < -100 || ball.x > 2148 || ball.y > fieldY + 100)) { LK.showGameOver(); } // Check if ball stopped moving and didn't score if (!ball.moving && gameState === 'shooting') { if (!(ball.x > goalX && ball.x < goalX + goalWidth && ball.y > goalY && ball.y < goalY + goalHeight)) { LK.setTimeout(function () { LK.showGameOver(); }, 1000); } } // Track ball position for collision detection ball.lastY = ball.y; };
===================================================================
--- original.js
+++ change.js
@@ -222,9 +222,9 @@
****/
// Game dimensions and positions
var screenWidth = 2560;
var screenHeight = 3200;
-var fieldY = screenHeight - 800;
+var fieldY = screenHeight - 1000; // Move field up to center it better in the game area
var goalWidth = 1200;
var goalHeight = 500;
var goalX = (screenWidth - goalWidth) / 2;
var goalY = fieldY - goalHeight;
@@ -242,9 +242,9 @@
anchorY: 0,
x: screenWidth / 2,
y: fieldY,
width: screenWidth,
- height: 800
+ height: 1000
}));
// Create goal
var goal = game.addChild(LK.getAsset('goal', {
anchorX: 0,