User prompt
sinek aşağı düşerken ucu aşağı doğru baksın yukarı çıkarken de ucu yukarı doğru baksın yani fiziği daha güzel olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
oyun ilerleyiceğine sinek olduğu yerde uçsun sürekli engellerden sağdan sola doğru gelsin ve engeller sürekli bir şekilde gelsin
User prompt
hala sürekli engel gelmiyor 6 tane engel geliyor sonra büyük bir boşluk onu düzeltir misin
User prompt
şuanki engel çıkma kodunu tamamen değiştir. Engeller sürekli şekilde arka arkaya gelsin ve öyle gelmeye devam etsin sonu gelmesin. engellerin arasını da 700 yap
Code edit (2 edits merged)
Please save this source code
User prompt
önce 3 tane engel geliyor sonra bekliyoz ya baya engel yok o engel bekleme arası olmasın sürekli engeller gelmeye devam etsin eşit aralıklar ile
Code edit (7 edits merged)
Please save this source code
User prompt
engeller sürekli gelmeye devam etsin çok büyük boşluklar olmasın arada
Code edit (1 edits merged)
Please save this source code
User prompt
üst engel ve alt engel ekranın üstüne ve altına yapışık olsun yani engellerin sadece ortalarından geçebilelim başka bir yerden geçemeyelim.
Code edit (1 edits merged)
Please save this source code
User prompt
Akıcıne Sinek
Initial prompt
bana flappy bird oyunu yap ismi de akione sinek olsun ve her zıpladığında ses çıkarsın bir de her puan aldığında da ses çıkarsın oyun da sadece bir yere çarpınca bitsin.
/****
* Classes
****/
var Fly = Container.expand(function () {
var self = Container.call(this);
var flyGraphics = self.attachAsset('fly', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocity = 0;
self.gravity = 0.8;
self.jumpPower = -15;
self.jump = function () {
self.velocity = self.jumpPower;
LK.getSound('jump').play();
};
self.update = function () {
self.velocity += self.gravity;
self.y += self.velocity;
// Rotate fly based on velocity for realistic physics
// When falling (positive velocity), rotate down
// When rising (negative velocity), rotate up
flyGraphics.rotation = self.velocity * 0.03; // Scale rotation based on velocity
// Prevent fly from going off screen
if (self.y < 50) {
self.y = 50;
self.velocity = 0;
}
if (self.y > 2680) {
self.y = 2680;
self.velocity = 0;
}
};
return self;
});
var ObstaclePair = Container.expand(function () {
var self = Container.call(this);
var gapSize = 600;
var gapPosition = Math.random() * 1000 + 600; // Random gap between 600-1600
var topObstacle = self.attachAsset('obstacleTop', {
anchorX: 0.5,
anchorY: 0
});
topObstacle.y = 0; // Attach to top of screen
topObstacle.height = gapPosition - gapSize / 2; // Extend down to gap start
var bottomObstacle = self.attachAsset('obstacleBottom', {
anchorX: 0.5,
anchorY: 0
});
bottomObstacle.y = gapPosition + gapSize / 2; // Start at gap end
bottomObstacle.height = 2732 - (gapPosition + gapSize / 2); // Extend to bottom of screen
self.speed = -5;
self.scored = false;
self.update = function () {
self.x += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var fly = game.addChild(new Fly());
fly.x = 300;
fly.y = 1366;
var obstacles = [];
var obstacleSpacing = 700;
var nextObstacleX = 2048;
var scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
scoreTxt.y = 100;
// Spawn obstacles continuously
function spawnObstacle() {
var obstacle = new ObstaclePair();
obstacle.x = nextObstacleX;
obstacles.push(obstacle);
game.addChild(obstacle);
nextObstacleX += obstacleSpacing;
}
// Initial obstacles to fill screen
for (var i = 0; i < 6; i++) {
spawnObstacle();
}
game.down = function (x, y, obj) {
fly.jump();
};
game.update = function () {
// Continuously spawn new obstacles to maintain flow
var rightmostObstacle = -999999;
for (var j = 0; j < obstacles.length; j++) {
if (obstacles[j].x > rightmostObstacle) {
rightmostObstacle = obstacles[j].x;
}
}
// Keep spawning obstacles to maintain continuous flow
while (rightmostObstacle < 2048 + obstacleSpacing) {
var obstacle = new ObstaclePair();
obstacle.x = rightmostObstacle + obstacleSpacing;
obstacles.push(obstacle);
game.addChild(obstacle);
rightmostObstacle = obstacle.x;
}
// Check collisions and scoring
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
// Remove obstacles that are off screen
if (obstacle.x < -200) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Check for scoring
if (!obstacle.scored && obstacle.x < fly.x) {
obstacle.scored = true;
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
LK.getSound('score').play();
}
// Check for collision
if (fly.intersects(obstacle)) {
LK.showGameOver();
return;
}
}
// Check if fly hits ground or ceiling
if (fly.y >= 2680 || fly.y <= 50) {
LK.showGameOver();
return;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -16,10 +16,12 @@
};
self.update = function () {
self.velocity += self.gravity;
self.y += self.velocity;
- // Continuous flying animation with slight up/down movement
- self.rotation = Math.sin(LK.ticks * 0.1) * 0.1;
+ // Rotate fly based on velocity for realistic physics
+ // When falling (positive velocity), rotate down
+ // When rising (negative velocity), rotate up
+ flyGraphics.rotation = self.velocity * 0.03; // Scale rotation based on velocity
// Prevent fly from going off screen
if (self.y < 50) {
self.y = 50;
self.velocity = 0;