User prompt
Fındıklara değince bir puan toplama sesi çıksın ve fındıklar kaybolsun
User prompt
Hem pipe ların hemde uppipe ların aralarında biraz daha boşluk olsun her yerde değil aralarda olsun
User prompt
Uppipe lar oyun alanının en üstünde olsun diğer Green pipe lar ile karşılıklı olsun ve aralarında kalan boşlukta fındıklar olsun
User prompt
Borular birleşik olmasın
User prompt
Altta olan borular gibi üstte de arada boşluk kalacak şekilde karşılıklı yeşil borular olsun oyun alanını en üstünde
User prompt
Simetrik olan boruların üstte olanlar oyun alnının en üstünde dursun ve oyun alanını önceki hali gibi genişlet
User prompt
Üstteki borular oyun alanının üstünde olsun ve diğer borulara değmesin fındıklar hem üst hem de alttaki boruların ortasında kalan boşluğa yerleşsin
User prompt
Fındıklar dedikten sonra bir puan alma sesi çıksın ve fındıklar yok olsun yeşil borular bir yerde bir üstte simetrik şekilde olsun fındıklar da boruların arasında kalsın ama borular neredeyse her yerde olsun altlı üstlü simetrik bir şekilde aynı flappy bird deki gibi olsun borular ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Yeşil borular hem yerde hem de üstte dikey bir şekilde dursun üsttekileri başı aşağı doğru baksın
User prompt
Oyundaki yeşil borular yerde dikey bir şekilde olsun ve oyun alanı daha dar olsun
User prompt
Oyunun adını Fındık Kuşu (Hazelnut Bird) olarak değiştir
User prompt
Oyunu başlat
Code edit (1 edits merged)
Please save this source code
User prompt
Fındık Ordusu (Hazelnut Army)
Initial prompt
Flappy bird gibi neredeyse aynısını yap 52 de oyun bitsin ve oyunun sonunda havai fişekler çıksın VE ORDU(52) diye büyük mor renkli bir yazı gelsin etrafta fındık resimleri olsun bölüm sonunda
/****
* 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 = 1.2;
self.flapPower = -16;
self.flap = function () {
self.velocity = self.flapPower;
LK.getSound('flap').play();
};
self.update = function () {
// Only move bird if game has started
if (!gameStarted) return;
self.velocity += self.gravity;
self.y += self.velocity;
// Rotate bird based on velocity
birdGraphics.rotation = Math.max(-0.5, Math.min(0.5, self.velocity * 0.05));
// Keep bird within screen bounds
if (self.y < 0) {
self.y = 0;
self.velocity = 0;
}
if (self.y > 2732) {
self.y = 2732;
self.velocity = 0;
}
};
return self;
});
var Firework = Container.expand(function () {
var self = Container.call(this);
var fireworkGraphics = self.attachAsset('firework', {
anchorX: 0.5,
anchorY: 0.5
});
self.lifetime = 0;
self.maxLifetime = 60;
self.velocityX = (Math.random() - 0.5) * 8;
self.velocityY = (Math.random() - 0.5) * 8;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.lifetime++;
// Fade out over time
fireworkGraphics.alpha = 1 - self.lifetime / self.maxLifetime;
// Remove when expired
if (self.lifetime >= self.maxLifetime) {
self.toDestroy = true;
}
};
return self;
});
var Hazelnut = Container.expand(function () {
var self = Container.call(this);
var hazelnutGraphics = self.attachAsset('hazelnut', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -6;
self.rotationSpeed = 0.1;
self.update = function () {
self.x += self.speed;
hazelnutGraphics.rotation += self.rotationSpeed;
// Remove hazelnut when off screen
if (self.x < -100) {
self.toDestroy = true;
}
};
return self;
});
var Pipe = Container.expand(function () {
var self = Container.call(this);
self.gapSize = 350; // Decreased gap size for less spacing
self.gapY = 800 + Math.random() * 1000; // Random gap position
self.speed = -6;
self.scored = false;
// Upper pipe at top of screen
var upperPipe = self.attachAsset('Uppipe', {
anchorX: 0.5,
anchorY: 0
});
upperPipe.y = 0; // Position at top of screen
upperPipe.scaleY = self.gapY / 2400; // Scale to reach gap start
// Lower pipe at bottom of screen
var lowerPipe = self.attachAsset('pipe', {
anchorX: 0.5,
anchorY: 1
});
lowerPipe.y = 2732; // Position at bottom of screen
lowerPipe.scaleY = (2732 - self.gapY - self.gapSize) / 2400; // Scale to reach gap end
self.update = function () {
self.x += self.speed;
// Check if bird has passed this pipe
if (!self.scored && self.x < bird.x - 60) {
self.scored = true;
score++;
LK.setScore(score);
scoreTxt.setText(score);
LK.getSound('score').play();
// Check for victory
if (score >= 999) {
LK.getSound('victory').play();
// Create firework at screen center
var centerFirework = new Firework();
centerFirework.x = 1024; // Center X of screen
centerFirework.y = 1366; // Center Y of screen
fireworks.push(centerFirework);
game.addChild(centerFirework);
LK.getSound('Fireworksboom').play();
triggerVictory();
}
}
// Remove pipe when off screen
if (self.x < -200) {
self.toDestroy = true;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var bird;
var pipes = [];
var hazelnuts = [];
var fireworks = [];
var score = 0;
var gameStarted = false;
var gameWon = false;
var showStartButton = true;
var pipeTimer = 0;
var hazelnutTimer = 0;
var fireworkTimer = 0;
var lastTouchTime = 0;
var flySoundPlaying = false;
var showRestartButton = false;
// Restart button
var restartButton = LK.getAsset('restartButton', {
anchorX: 0.5,
anchorY: 0.5
});
restartButton.x = 1024;
restartButton.y = 1366;
restartButton.alpha = 0;
game.addChild(restartButton);
// Restart button text
var restartButtonTxt = new Text2('RESTART', {
size: 60,
fill: 0xFFFFFF
});
restartButtonTxt.anchor.set(0.5, 0.5);
restartButtonTxt.x = 1024;
restartButtonTxt.y = 1366;
restartButtonTxt.alpha = 0;
game.addChild(restartButtonTxt);
// Score display
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Victory text
var victoryTxt = new Text2('TEBRIKLER! 999 PUAN!', {
size: 150,
fill: 0x800080
});
victoryTxt.anchor.set(0.5, 0.5);
victoryTxt.alpha = 0;
LK.gui.center.addChild(victoryTxt);
// Thank you text
var thankYouTxt = new Text2('Oyunu oynadığınız için teşekkürler\n(Thank you for playing the game)', {
size: 80,
fill: 0xFFFFFF
});
thankYouTxt.anchor.set(0.5, 0.5);
thankYouTxt.alpha = 0;
LK.gui.center.addChild(thankYouTxt);
// Powered by text
var poweredByTxt = new Text2('Powered by Tuğra Karakuş', {
size: 60,
fill: 0xCCCCCC
});
poweredByTxt.anchor.set(0.5, 0.5);
poweredByTxt.alpha = 0;
LK.gui.center.addChild(poweredByTxt);
// Start button
var startButton = LK.getAsset('startButton', {
anchorX: 0.5,
anchorY: 0.5
});
startButton.x = 1024;
startButton.y = 1366;
game.addChild(startButton);
// Start button text
var startButtonTxt = new Text2('START', {
size: 60,
fill: 0xFFFFFF
});
startButtonTxt.anchor.set(0.5, 0.5);
startButtonTxt.x = 1024;
startButtonTxt.y = 1366;
game.addChild(startButtonTxt);
// Initialize bird
bird = game.addChild(new Bird());
bird.x = 300;
bird.y = 1366;
// Initialize score display
scoreTxt.setText('0');
LK.setScore(0);
function triggerVictory() {
gameWon = true;
gameStarted = false; // Stop the game
// Show victory text with animation
tween(victoryTxt, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeOut
});
// Show thank you text after victory text
LK.setTimeout(function () {
thankYouTxt.y = LK.gui.center.y - 100;
tween(thankYouTxt, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeOut
});
}, 1500);
// Show powered by text after thank you text
LK.setTimeout(function () {
poweredByTxt.y = LK.gui.center.y + 150;
tween(poweredByTxt, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeOut
});
}, 2500);
// Start fireworks
fireworkTimer = 0;
// Show you win after displaying all messages
LK.setTimeout(function () {
LK.showYouWin();
}, 6000);
}
function createFirework() {
var firework = new Firework();
firework.x = Math.random() * 2048;
firework.y = Math.random() * 2732;
fireworks.push(firework);
game.addChild(firework);
LK.getSound('Fireworksboom').play();
}
function restartGame() {
// Reset game variables
gameStarted = false;
gameWon = false;
showStartButton = true;
showRestartButton = false;
score = 0;
LK.setScore(0);
scoreTxt.setText('0');
pipeTimer = 0;
hazelnutTimer = 0;
fireworkTimer = 0;
lastTouchTime = 0;
flySoundPlaying = false;
// Reset bird position
bird.x = 300;
bird.y = 1366;
bird.velocity = 0;
// Clear all game objects
for (var i = pipes.length - 1; i >= 0; i--) {
pipes[i].destroy();
}
pipes = [];
for (var j = hazelnuts.length - 1; j >= 0; j--) {
hazelnuts[j].destroy();
}
hazelnuts = [];
for (var k = fireworks.length - 1; k >= 0; k--) {
fireworks[k].destroy();
}
fireworks = [];
// Reset UI elements
startButton.alpha = 1;
startButtonTxt.alpha = 1;
restartButton.alpha = 0;
restartButtonTxt.alpha = 0;
victoryTxt.alpha = 0;
thankYouTxt.alpha = 0;
poweredByTxt.alpha = 0;
}
game.down = function (x, y, obj) {
if (!gameStarted && showStartButton) {
// Check if start button was clicked
var buttonBounds = {
left: startButton.x - startButton.width / 2,
right: startButton.x + startButton.width / 2,
top: startButton.y - startButton.height / 2,
bottom: startButton.y + startButton.height / 2
};
if (x >= buttonBounds.left && x <= buttonBounds.right && y >= buttonBounds.top && y <= buttonBounds.bottom) {
gameStarted = true;
showStartButton = false;
startButton.alpha = 0;
startButtonTxt.alpha = 0;
}
}
if (showRestartButton) {
// Check if restart button was clicked
var restartBounds = {
left: restartButton.x - restartButton.width / 2,
right: restartButton.x + restartButton.width / 2,
top: restartButton.y - restartButton.height / 2,
bottom: restartButton.y + restartButton.height / 2
};
if (x >= restartBounds.left && x <= restartBounds.right && y >= restartBounds.top && y <= restartBounds.bottom) {
restartGame();
}
}
if (gameStarted && !gameWon) {
// Update last touch time and stop fly sound
lastTouchTime = LK.ticks;
if (flySoundPlaying) {
LK.getSound('fly').stop();
flySoundPlaying = false;
}
bird.flap();
}
};
game.update = function () {
if (!gameStarted || showStartButton) return;
// Handle fly sound when bird is falling
if (gameStarted && !gameWon) {
var timeSinceLastTouch = (LK.ticks - lastTouchTime) / 60; // Convert to seconds
if (timeSinceLastTouch >= 0.5 && !flySoundPlaying && bird.velocity > 0) {
LK.getSound('fly').play();
flySoundPlaying = true;
}
}
// Spawn pipes
pipeTimer++;
if (pipeTimer >= 120) {
// Every 2 seconds at 60fps for faster rendering
var pipe = new Pipe();
pipe.x = 1800;
pipes.push(pipe);
game.addChild(pipe);
pipeTimer = 0;
}
// Spawn hazelnuts in pipe gaps
if (pipes.length > 0) {
var latestPipe = pipes[pipes.length - 1];
if (latestPipe.x < 1600 && latestPipe.x > 1400) {
// Spawn hazelnut in the gap of the latest pipe
var hazelnut = new Hazelnut();
hazelnut.x = latestPipe.x;
hazelnut.y = latestPipe.gapY + latestPipe.gapSize / 2;
hazelnuts.push(hazelnut);
game.addChild(hazelnut);
}
}
// Handle fireworks after victory
if (gameWon) {
fireworkTimer++;
if (fireworkTimer % 10 === 0) {
// Create firework every 10 frames
createFirework();
}
}
// Update and check collisions with pipes
for (var i = pipes.length - 1; i >= 0; i--) {
var pipe = pipes[i];
if (pipe.toDestroy) {
pipe.destroy();
pipes.splice(i, 1);
continue;
}
// Check collision with bird using intersects - check individual pipe parts
var upperPipe = pipe.children[0]; // First child is upper pipe
var lowerPipe = pipe.children[1]; // Second child is lower pipe
if (bird.intersects(upperPipe) || bird.intersects(lowerPipe)) {
LK.effects.flashScreen(0xff0000, 1000);
showRestartButton = true;
restartButton.alpha = 1;
restartButtonTxt.alpha = 1;
LK.showGameOver();
return;
}
}
// Update hazelnuts
for (var j = hazelnuts.length - 1; j >= 0; j--) {
var hazelnut = hazelnuts[j];
if (hazelnut.toDestroy) {
hazelnut.destroy();
hazelnuts.splice(j, 1);
continue;
}
// Check collision with bird
if (bird.intersects(hazelnut)) {
hazelnut.destroy();
hazelnuts.splice(j, 1);
}
}
// Update fireworks
for (var k = fireworks.length - 1; k >= 0; k--) {
var firework = fireworks[k];
if (firework.toDestroy) {
firework.destroy();
fireworks.splice(k, 1);
}
}
// Check if bird hits ground or ceiling
if (bird.y <= 0 || bird.y >= 2732) {
LK.effects.flashScreen(0xff0000, 1000);
showRestartButton = true;
restartButton.alpha = 1;
restartButtonTxt.alpha = 1;
LK.showGameOver();
}
}; /****
* 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 = 1.2;
self.flapPower = -16;
self.flap = function () {
self.velocity = self.flapPower;
LK.getSound('flap').play();
};
self.update = function () {
// Only move bird if game has started
if (!gameStarted) return;
self.velocity += self.gravity;
self.y += self.velocity;
// Rotate bird based on velocity
birdGraphics.rotation = Math.max(-0.5, Math.min(0.5, self.velocity * 0.05));
// Keep bird within screen bounds
if (self.y < 0) {
self.y = 0;
self.velocity = 0;
}
if (self.y > 2732) {
self.y = 2732;
self.velocity = 0;
}
};
return self;
});
var Firework = Container.expand(function () {
var self = Container.call(this);
var fireworkGraphics = self.attachAsset('firework', {
anchorX: 0.5,
anchorY: 0.5
});
self.lifetime = 0;
self.maxLifetime = 60;
self.velocityX = (Math.random() - 0.5) * 8;
self.velocityY = (Math.random() - 0.5) * 8;
self.update = function () {
self.x += self.velocityX;
self.y += self.velocityY;
self.lifetime++;
// Fade out over time
fireworkGraphics.alpha = 1 - self.lifetime / self.maxLifetime;
// Remove when expired
if (self.lifetime >= self.maxLifetime) {
self.toDestroy = true;
}
};
return self;
});
var Hazelnut = Container.expand(function () {
var self = Container.call(this);
var hazelnutGraphics = self.attachAsset('hazelnut', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -6;
self.rotationSpeed = 0.1;
self.update = function () {
self.x += self.speed;
hazelnutGraphics.rotation += self.rotationSpeed;
// Remove hazelnut when off screen
if (self.x < -100) {
self.toDestroy = true;
}
};
return self;
});
var Pipe = Container.expand(function () {
var self = Container.call(this);
self.gapSize = 350; // Decreased gap size for less spacing
self.gapY = 800 + Math.random() * 1000; // Random gap position
self.speed = -6;
self.scored = false;
// Upper pipe at top of screen
var upperPipe = self.attachAsset('Uppipe', {
anchorX: 0.5,
anchorY: 0
});
upperPipe.y = 0; // Position at top of screen
upperPipe.scaleY = self.gapY / 2400; // Scale to reach gap start
// Lower pipe at bottom of screen
var lowerPipe = self.attachAsset('pipe', {
anchorX: 0.5,
anchorY: 1
});
lowerPipe.y = 2732; // Position at bottom of screen
lowerPipe.scaleY = (2732 - self.gapY - self.gapSize) / 2400; // Scale to reach gap end
self.update = function () {
self.x += self.speed;
// Check if bird has passed this pipe
if (!self.scored && self.x < bird.x - 60) {
self.scored = true;
score++;
LK.setScore(score);
scoreTxt.setText(score);
LK.getSound('score').play();
// Check for victory
if (score >= 999) {
LK.getSound('victory').play();
// Create firework at screen center
var centerFirework = new Firework();
centerFirework.x = 1024; // Center X of screen
centerFirework.y = 1366; // Center Y of screen
fireworks.push(centerFirework);
game.addChild(centerFirework);
LK.getSound('Fireworksboom').play();
triggerVictory();
}
}
// Remove pipe when off screen
if (self.x < -200) {
self.toDestroy = true;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var bird;
var pipes = [];
var hazelnuts = [];
var fireworks = [];
var score = 0;
var gameStarted = false;
var gameWon = false;
var showStartButton = true;
var pipeTimer = 0;
var hazelnutTimer = 0;
var fireworkTimer = 0;
var lastTouchTime = 0;
var flySoundPlaying = false;
var showRestartButton = false;
// Restart button
var restartButton = LK.getAsset('restartButton', {
anchorX: 0.5,
anchorY: 0.5
});
restartButton.x = 1024;
restartButton.y = 1366;
restartButton.alpha = 0;
game.addChild(restartButton);
// Restart button text
var restartButtonTxt = new Text2('RESTART', {
size: 60,
fill: 0xFFFFFF
});
restartButtonTxt.anchor.set(0.5, 0.5);
restartButtonTxt.x = 1024;
restartButtonTxt.y = 1366;
restartButtonTxt.alpha = 0;
game.addChild(restartButtonTxt);
// Score display
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Victory text
var victoryTxt = new Text2('TEBRIKLER! 999 PUAN!', {
size: 150,
fill: 0x800080
});
victoryTxt.anchor.set(0.5, 0.5);
victoryTxt.alpha = 0;
LK.gui.center.addChild(victoryTxt);
// Thank you text
var thankYouTxt = new Text2('Oyunu oynadığınız için teşekkürler\n(Thank you for playing the game)', {
size: 80,
fill: 0xFFFFFF
});
thankYouTxt.anchor.set(0.5, 0.5);
thankYouTxt.alpha = 0;
LK.gui.center.addChild(thankYouTxt);
// Powered by text
var poweredByTxt = new Text2('Powered by Tuğra Karakuş', {
size: 60,
fill: 0xCCCCCC
});
poweredByTxt.anchor.set(0.5, 0.5);
poweredByTxt.alpha = 0;
LK.gui.center.addChild(poweredByTxt);
// Start button
var startButton = LK.getAsset('startButton', {
anchorX: 0.5,
anchorY: 0.5
});
startButton.x = 1024;
startButton.y = 1366;
game.addChild(startButton);
// Start button text
var startButtonTxt = new Text2('START', {
size: 60,
fill: 0xFFFFFF
});
startButtonTxt.anchor.set(0.5, 0.5);
startButtonTxt.x = 1024;
startButtonTxt.y = 1366;
game.addChild(startButtonTxt);
// Initialize bird
bird = game.addChild(new Bird());
bird.x = 300;
bird.y = 1366;
// Initialize score display
scoreTxt.setText('0');
LK.setScore(0);
function triggerVictory() {
gameWon = true;
gameStarted = false; // Stop the game
// Show victory text with animation
tween(victoryTxt, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeOut
});
// Show thank you text after victory text
LK.setTimeout(function () {
thankYouTxt.y = LK.gui.center.y - 100;
tween(thankYouTxt, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeOut
});
}, 1500);
// Show powered by text after thank you text
LK.setTimeout(function () {
poweredByTxt.y = LK.gui.center.y + 150;
tween(poweredByTxt, {
alpha: 1
}, {
duration: 1000,
easing: tween.easeOut
});
}, 2500);
// Start fireworks
fireworkTimer = 0;
// Show you win after displaying all messages
LK.setTimeout(function () {
LK.showYouWin();
}, 6000);
}
function createFirework() {
var firework = new Firework();
firework.x = Math.random() * 2048;
firework.y = Math.random() * 2732;
fireworks.push(firework);
game.addChild(firework);
LK.getSound('Fireworksboom').play();
}
function restartGame() {
// Reset game variables
gameStarted = false;
gameWon = false;
showStartButton = true;
showRestartButton = false;
score = 0;
LK.setScore(0);
scoreTxt.setText('0');
pipeTimer = 0;
hazelnutTimer = 0;
fireworkTimer = 0;
lastTouchTime = 0;
flySoundPlaying = false;
// Reset bird position
bird.x = 300;
bird.y = 1366;
bird.velocity = 0;
// Clear all game objects
for (var i = pipes.length - 1; i >= 0; i--) {
pipes[i].destroy();
}
pipes = [];
for (var j = hazelnuts.length - 1; j >= 0; j--) {
hazelnuts[j].destroy();
}
hazelnuts = [];
for (var k = fireworks.length - 1; k >= 0; k--) {
fireworks[k].destroy();
}
fireworks = [];
// Reset UI elements
startButton.alpha = 1;
startButtonTxt.alpha = 1;
restartButton.alpha = 0;
restartButtonTxt.alpha = 0;
victoryTxt.alpha = 0;
thankYouTxt.alpha = 0;
poweredByTxt.alpha = 0;
}
game.down = function (x, y, obj) {
if (!gameStarted && showStartButton) {
// Check if start button was clicked
var buttonBounds = {
left: startButton.x - startButton.width / 2,
right: startButton.x + startButton.width / 2,
top: startButton.y - startButton.height / 2,
bottom: startButton.y + startButton.height / 2
};
if (x >= buttonBounds.left && x <= buttonBounds.right && y >= buttonBounds.top && y <= buttonBounds.bottom) {
gameStarted = true;
showStartButton = false;
startButton.alpha = 0;
startButtonTxt.alpha = 0;
}
}
if (showRestartButton) {
// Check if restart button was clicked
var restartBounds = {
left: restartButton.x - restartButton.width / 2,
right: restartButton.x + restartButton.width / 2,
top: restartButton.y - restartButton.height / 2,
bottom: restartButton.y + restartButton.height / 2
};
if (x >= restartBounds.left && x <= restartBounds.right && y >= restartBounds.top && y <= restartBounds.bottom) {
restartGame();
}
}
if (gameStarted && !gameWon) {
// Update last touch time and stop fly sound
lastTouchTime = LK.ticks;
if (flySoundPlaying) {
LK.getSound('fly').stop();
flySoundPlaying = false;
}
bird.flap();
}
};
game.update = function () {
if (!gameStarted || showStartButton) return;
// Handle fly sound when bird is falling
if (gameStarted && !gameWon) {
var timeSinceLastTouch = (LK.ticks - lastTouchTime) / 60; // Convert to seconds
if (timeSinceLastTouch >= 0.5 && !flySoundPlaying && bird.velocity > 0) {
LK.getSound('fly').play();
flySoundPlaying = true;
}
}
// Spawn pipes
pipeTimer++;
if (pipeTimer >= 120) {
// Every 2 seconds at 60fps for faster rendering
var pipe = new Pipe();
pipe.x = 1800;
pipes.push(pipe);
game.addChild(pipe);
pipeTimer = 0;
}
// Spawn hazelnuts in pipe gaps
if (pipes.length > 0) {
var latestPipe = pipes[pipes.length - 1];
if (latestPipe.x < 1600 && latestPipe.x > 1400) {
// Spawn hazelnut in the gap of the latest pipe
var hazelnut = new Hazelnut();
hazelnut.x = latestPipe.x;
hazelnut.y = latestPipe.gapY + latestPipe.gapSize / 2;
hazelnuts.push(hazelnut);
game.addChild(hazelnut);
}
}
// Handle fireworks after victory
if (gameWon) {
fireworkTimer++;
if (fireworkTimer % 10 === 0) {
// Create firework every 10 frames
createFirework();
}
}
// Update and check collisions with pipes
for (var i = pipes.length - 1; i >= 0; i--) {
var pipe = pipes[i];
if (pipe.toDestroy) {
pipe.destroy();
pipes.splice(i, 1);
continue;
}
// Check collision with bird using intersects - check individual pipe parts
var upperPipe = pipe.children[0]; // First child is upper pipe
var lowerPipe = pipe.children[1]; // Second child is lower pipe
if (bird.intersects(upperPipe) || bird.intersects(lowerPipe)) {
LK.effects.flashScreen(0xff0000, 1000);
showRestartButton = true;
restartButton.alpha = 1;
restartButtonTxt.alpha = 1;
LK.showGameOver();
return;
}
}
// Update hazelnuts
for (var j = hazelnuts.length - 1; j >= 0; j--) {
var hazelnut = hazelnuts[j];
if (hazelnut.toDestroy) {
hazelnut.destroy();
hazelnuts.splice(j, 1);
continue;
}
// Check collision with bird
if (bird.intersects(hazelnut)) {
hazelnut.destroy();
hazelnuts.splice(j, 1);
}
}
// Update fireworks
for (var k = fireworks.length - 1; k >= 0; k--) {
var firework = fireworks[k];
if (firework.toDestroy) {
firework.destroy();
fireworks.splice(k, 1);
}
}
// Check if bird hits ground or ceiling
if (bird.y <= 0 || bird.y >= 2732) {
LK.effects.flashScreen(0xff0000, 1000);
showRestartButton = true;
restartButton.alpha = 1;
restartButtonTxt.alpha = 1;
LK.showGameOver();
}
};
Fireworks. In-Game asset. 2d. High contrast. No shadows
Green pipe. In-Game asset. 2d. High contrast. No shadows
hazelnut. In-Game asset. 2d. High contrast. No shadows
Start button. In-Game asset. 2d. High contrast. No shadows
Restart button. In-Game asset. 2d. High contrast. No shadows
Top şeklinde flappy bird gibi bir kuş çiz ama mor renkli. In-Game asset. 2d. High contrast. No shadows. flapptbird