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 var targetRotation = Math.min(Math.max(self.velocity * 0.05, -0.5), 0.8); birdGraphics.rotation = targetRotation; }; return self; }); var Pipe = Container.expand(function () { var self = Container.call(this); self.speed = -4; self.passed = false; self.gapSize = 180; // 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 = 90; // frames between pipe spawns var lastPipeScore = 0; // 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 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; } } } } // 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; } // 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); } } // Check all collisions checkCollisions(); };
===================================================================
--- original.js
+++ change.js
@@ -64,16 +64,29 @@
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;
};
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