User prompt
Para toplayınca bir puan artsın borulardan geçerken 1 puan azalsın
User prompt
Altınları geçiş yerlerine yerleştir
User prompt
Borular yapışık olmasın
User prompt
Boruların aralarını aç
User prompt
Kuş düşerken kuş düşme efekti olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Altın ekle
User prompt
Mariodaki borulardan yap
User prompt
Çok uzunn olsun yani çok fazla
User prompt
Boruları uzat
Code edit (1 edits merged)
Please save this source code
User prompt
Flippy Bird
Initial prompt
Bana flippy bird oyununu yap
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bird = Container.expand(function () { var self = Container.call(this); var birdGraphics = self.attachAsset('bird', { anchorX: 0.5, anchorY: 0.5 }); self.velocity = 0; self.gravity = 0.8; self.flapStrength = -12; self.maxFallSpeed = 15; self.rotation = 0; self.flap = function () { self.velocity = self.flapStrength; LK.getSound('flap').play(); // Animate bird flap tween(birdGraphics, { rotation: -0.3 }, { duration: 150 }); tween(birdGraphics, { rotation: 0 }, { duration: 150, onFinish: function onFinish() { if (self.velocity > 0) { tween(birdGraphics, { rotation: 0.3 }, { duration: 200 }); } } }); }; self.update = function () { // Apply gravity self.velocity += self.gravity; if (self.velocity > self.maxFallSpeed) { self.velocity = self.maxFallSpeed; } // Update position self.y += self.velocity; // Update rotation based on velocity with falling effect var targetRotation = Math.min(Math.max(self.velocity * 0.05, -0.5), 0.8); // Add dramatic falling effect when bird is falling fast if (self.velocity > 8) { // Create falling spin effect tween(birdGraphics, { rotation: targetRotation + Math.PI * 2 }, { duration: 800, easing: tween.easeIn }); // Add slight scale effect during fall tween(birdGraphics, { scaleX: 0.9, scaleY: 1.1 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(birdGraphics, { scaleX: 1, scaleY: 1 }, { duration: 200 }); } }); } else { // Normal rotation for regular movement birdGraphics.rotation = targetRotation; } }; return self; }); var Coin = Container.expand(function () { var self = Container.call(this); var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -4; self.collected = false; self.rotationSpeed = 0.1; self.update = function () { self.x += self.speed; // Rotate coin for visual appeal coinGraphics.rotation += self.rotationSpeed; // Gentle floating animation coinGraphics.y = Math.sin(LK.ticks * 0.05) * 3; }; return self; }); var Pipe = Container.expand(function () { var self = Container.call(this); self.speed = -4; self.passed = false; self.gapSize = 300; // Create top pipe self.topPipe = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 1 }); // Create top pipe segment (Mario-style cap) self.topPipeSegment = self.attachAsset('pipeSegment', { anchorX: 0.5, anchorY: 1 }); // Create bottom pipe self.bottomPipe = self.attachAsset('pipe', { anchorX: 0.5, anchorY: 0 }); // Create bottom pipe segment (Mario-style cap) self.bottomPipeSegment = self.attachAsset('pipeSegment', { anchorX: 0.5, anchorY: 0 }); self.setGapPosition = function (gapY) { self.topPipe.y = gapY - self.gapSize / 2; self.bottomPipe.y = gapY + self.gapSize / 2; // Position the Mario-style pipe segments self.topPipeSegment.y = gapY - self.gapSize / 2; self.bottomPipeSegment.y = gapY + self.gapSize / 2; }; self.update = function () { self.x += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb }); /**** * Game Code ****/ // Game variables var bird; var pipes = []; var ground; var gameStarted = false; var gameSpeed = 4; var pipeSpawnTimer = 0; var pipeSpawnInterval = 180; // frames between pipe spawns var lastPipeScore = 0; var coins = []; var coinSpawnTimer = 0; var coinSpawnInterval = 200; // frames between coin spawns - slightly after pipes // UI elements var scoreTxt = new Text2('0', { size: 80, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var instructionTxt = new Text2('Tap to Flap!', { size: 60, fill: 0xFFFFFF }); instructionTxt.anchor.set(0.5, 0.5); LK.gui.center.addChild(instructionTxt); // Create bird bird = game.addChild(new Bird()); bird.x = 400; bird.y = 1366; // Center of screen height // Create ground ground = game.addChild(LK.getAsset('ground', { anchorX: 0, anchorY: 0 })); ground.x = 0; ground.y = 2732 - 100; // Bottom of screen // Game state tracking var lastBirdY = bird.y; var lastGroundCollision = false; var lastCeilingCollision = false; function spawnPipe() { var pipe = new Pipe(); pipe.x = 2048 + 60; // Start off-screen right // Random gap position (avoiding too high or too low) var minGapY = 300; var maxGapY = ground.y - 300; var gapY = minGapY + Math.random() * (maxGapY - minGapY); pipe.setGapPosition(gapY); pipe.speed = -gameSpeed; pipes.push(pipe); game.addChild(pipe); } function spawnCoin() { // Only spawn coin if there's a recent pipe to place it with if (pipes.length > 0) { var latestPipe = pipes[pipes.length - 1]; var coin = new Coin(); // Place coin slightly ahead of the pipe gap coin.x = latestPipe.x + 150; // Position coin in the gap area // Place coin in the center of the pipe gap var gapCenterY = (latestPipe.topPipe.y + latestPipe.bottomPipe.y) / 2; coin.y = gapCenterY; coin.speed = -gameSpeed; coins.push(coin); game.addChild(coin); } } function checkCollisions() { // Check ground collision var currentGroundCollision = bird.y + 22 >= ground.y; // bird half-height if (!lastGroundCollision && currentGroundCollision) { LK.getSound('hit').play(); LK.showGameOver(); return; } lastGroundCollision = currentGroundCollision; // Check ceiling collision var currentCeilingCollision = bird.y - 22 <= 0; if (!lastCeilingCollision && currentCeilingCollision) { LK.getSound('hit').play(); LK.showGameOver(); return; } lastCeilingCollision = currentCeilingCollision; // Check pipe collisions and scoring for (var i = pipes.length - 1; i >= 0; i--) { var pipe = pipes[i]; // Check if bird passed through pipe (scoring) if (!pipe.passed && bird.x > pipe.x + 60) { pipe.passed = true; LK.setScore(LK.getScore() - 1); scoreTxt.setText(LK.getScore()); LK.getSound('score').play(); // Increase difficulty every 5 pipes if (LK.getScore() % 5 === 0) { gameSpeed += 0.5; } } // Check collision with pipes var birdLeft = bird.x - 30; var birdRight = bird.x + 30; var birdTop = bird.y - 22; var birdBottom = bird.y + 22; var pipeLeft = pipe.x - 60; var pipeRight = pipe.x + 60; if (birdRight > pipeLeft && birdLeft < pipeRight) { // Bird is horizontally aligned with pipe var topPipeBottom = pipe.topPipe.y; var bottomPipeTop = pipe.bottomPipe.y; if (birdTop < topPipeBottom || birdBottom > bottomPipeTop) { // Collision with pipe LK.getSound('hit').play(); LK.showGameOver(); return; } } } // Check coin collection for (var j = coins.length - 1; j >= 0; j--) { var coin = coins[j]; if (!coin.collected && bird.intersects(coin)) { coin.collected = true; LK.setScore(LK.getScore() + 1); // Coins worth 1 point scoreTxt.setText(LK.getScore()); LK.getSound('coin').play(); // Visual effect - make coin disappear with scaling tween(coin, { scaleX: 0, scaleY: 0, alpha: 0 }, { duration: 200, onFinish: function onFinish() { coin.destroy(); } }); coins.splice(j, 1); } } } // Touch controls game.down = function (x, y, obj) { if (!gameStarted) { gameStarted = true; instructionTxt.alpha = 0; } bird.flap(); }; // Main game loop game.update = function () { if (!gameStarted) { return; } // Update bird lastBirdY = bird.y; // Spawn pipes pipeSpawnTimer++; if (pipeSpawnTimer >= pipeSpawnInterval) { spawnPipe(); pipeSpawnTimer = 0; } // Spawn coins - spawn a coin shortly after each pipe coinSpawnTimer++; if (coinSpawnTimer >= coinSpawnInterval) { spawnCoin(); coinSpawnTimer = 0; } // Update pipes and remove off-screen ones for (var i = pipes.length - 1; i >= 0; i--) { var pipe = pipes[i]; pipe.speed = -gameSpeed; if (pipe.x < -120) { pipe.destroy(); pipes.splice(i, 1); } } // Update coins and remove off-screen ones for (var j = coins.length - 1; j >= 0; j--) { var coin = coins[j]; coin.speed = -gameSpeed; if (coin.x < -40) { coin.destroy(); coins.splice(j, 1); } } // Check all collisions checkCollisions(); };
===================================================================
--- original.js
+++ change.js
@@ -238,9 +238,9 @@
var pipe = pipes[i];
// Check if bird passed through pipe (scoring)
if (!pipe.passed && bird.x > pipe.x + 60) {
pipe.passed = true;
- LK.setScore(LK.getScore() + 1);
+ LK.setScore(LK.getScore() - 1);
scoreTxt.setText(LK.getScore());
LK.getSound('score').play();
// Increase difficulty every 5 pipes
if (LK.getScore() % 5 === 0) {
@@ -270,9 +270,9 @@
for (var j = coins.length - 1; j >= 0; j--) {
var coin = coins[j];
if (!coin.collected && bird.intersects(coin)) {
coin.collected = true;
- LK.setScore(LK.getScore() + 5); // Coins worth 5 points
+ LK.setScore(LK.getScore() + 1); // Coins worth 1 point
scoreTxt.setText(LK.getScore());
LK.getSound('coin').play();
// Visual effect - make coin disappear with scaling
tween(coin, {
Kuş. In-Game asset. 2d. High contrast. No shadows
İnek. In-Game asset. 2d. High contrast. No shadows
Koyun. In-Game asset. 2d. High contrast. No shadows
Domuz. In-Game asset. 2d. High contrast. No shadows
Tavuk. In-Game asset. 2d. High contrast. No shadows
Toprak. In-Game asset. 2d. High contrast. No shadows