User prompt
bu yerleri biraz daha sıkı tut
User prompt
uçağın geçebileceği şekilde düzenle
User prompt
place towers in random places
User prompt
more a little bit
User prompt
enlarge the plane
User prompt
geri al
User prompt
yerlerini bozmadan
User prompt
yukarıdaki kuleler aşşağı baksın
User prompt
ve dondürdüğün kuleleri eskisi gibi yerleştir
User prompt
yukarıdaki kuleleri aşşağıya dondur
User prompt
zoom the plane
User prompt
a little bit more
User prompt
and zoom more
User prompt
Extend the towers pictures to the border
User prompt
Extend the towers to the border
User prompt
Zoom in on the screen
User prompt
bigger towers and random sizes
User prompt
Hey buddy, to make this like the ''Flappy Bird'' game, place the towers at certain intervals so that they are equal at the top and bottom, and when the plane passes between the towers, give it 1 point, and the plane's speed will increase by 1 for every 15 points.
User prompt
Hey dostum bunun ''Flappy Bird'' oyununa benzemesi için belirli aralılarla üste ve alta eşit olacak şekilde kuleleri koy ve uçak kulelerin arasından geçtiğindeyse ona 1 puan ver uçağın hızı her 15 puanda 1 artsın
User prompt
binaları altta ve üstte eşit olacak şekilde yerleştir
User prompt
dostum bunu flappy bird oyununa benzetmen lazım
Code edit (1 edits merged)
Please save this source code
User prompt
Sky Scraper Flight
Initial prompt
hocam bana flappy birds yap fakar kuş yerine uçak koy ve borularda gökdelen olsun
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Airplane = Container.expand(function () {
var self = Container.call(this);
var airplaneGraphics = self.attachAsset('airplane', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocity = 0;
self.gravity = 0.8;
self.jumpPower = -12;
self.maxVelocity = 15;
self.update = function () {
// Apply gravity
self.velocity += self.gravity;
// Limit velocity
if (self.velocity > self.maxVelocity) {
self.velocity = self.maxVelocity;
}
if (self.velocity < -self.maxVelocity) {
self.velocity = -self.maxVelocity;
}
// Update position
self.y += self.velocity;
// Rotate airplane based on velocity for visual effect
airplaneGraphics.rotation = Math.max(-0.5, Math.min(0.5, self.velocity * 0.05));
// Keep airplane within screen bounds
if (self.y < 0) {
self.y = 0;
self.velocity = 0;
}
if (self.y > 2732) {
self.y = 2732;
self.velocity = 0;
}
};
self.jump = function () {
self.velocity = self.jumpPower;
LK.getSound('fly').play();
};
return self;
});
var Building = Container.expand(function (topHeight, bottomHeight, gapY) {
var self = Container.call(this);
// Top building
var topBuilding = self.attachAsset('building', {
anchorX: 0,
anchorY: 1,
scaleY: topHeight / 800
});
topBuilding.y = gapY - 150; // Gap size of 300px
// Bottom building
var bottomBuilding = self.attachAsset('building', {
anchorX: 0,
anchorY: 0,
scaleY: bottomHeight / 800
});
bottomBuilding.y = gapY + 150;
self.speed = -4;
self.passed = false;
self.update = function () {
self.x += self.speed;
};
self.checkCollision = function (airplane) {
var airplaneLeft = airplane.x - 60;
var airplaneRight = airplane.x + 60;
var airplaneTop = airplane.y - 30;
var airplaneBottom = airplane.y + 30;
var buildingLeft = self.x;
var buildingRight = self.x + 200;
// Check if airplane is within building's x range
if (airplaneRight > buildingLeft && airplaneLeft < buildingRight) {
// Check collision with top building
if (airplaneTop < topBuilding.y) {
return true;
}
// Check collision with bottom building
if (airplaneBottom > bottomBuilding.y) {
return true;
}
}
return false;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var airplane;
var buildings = [];
var gameSpeed = 4;
var buildingSpawnTimer = 0;
var buildingSpawnInterval = 90; // frames between buildings
var gameStarted = false;
// UI Elements
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var instructionTxt = new Text2('TAP TO FLY', {
size: 80,
fill: 0xFFFFFF
});
instructionTxt.anchor.set(0.5, 0.5);
instructionTxt.x = 1024;
instructionTxt.y = 1366;
game.addChild(instructionTxt);
// Initialize airplane
airplane = game.addChild(new Airplane());
airplane.x = 400;
airplane.y = 1366;
// Update score display
function updateScore() {
scoreTxt.setText(LK.getScore());
}
// Spawn new building
function spawnBuilding() {
var gapY = Math.random() * (2000 - 700) + 700; // Gap between y=700 and y=2000
var topHeight = gapY - 150;
var bottomHeight = 2732 - (gapY + 150);
var building = new Building(topHeight, bottomHeight, gapY);
building.x = 2048 + 200; // Start off-screen to the right
buildings.push(building);
game.addChild(building);
}
// Game input handling
game.down = function (x, y, obj) {
if (!gameStarted) {
gameStarted = true;
instructionTxt.visible = false;
// Spawn first building
spawnBuilding();
}
airplane.jump();
};
// Main game loop
game.update = function () {
if (!gameStarted) return;
// Update building spawn timer
buildingSpawnTimer++;
if (buildingSpawnTimer >= buildingSpawnInterval) {
buildingSpawnTimer = 0;
spawnBuilding();
// Gradually increase difficulty
if (buildingSpawnInterval > 60) {
buildingSpawnInterval -= 0.2;
}
}
// Check collisions and update buildings
for (var i = buildings.length - 1; i >= 0; i--) {
var building = buildings[i];
// Check collision
if (building.checkCollision(airplane)) {
LK.getSound('crash').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
// Check if airplane passed building (score)
if (!building.passed && building.x + 200 < airplane.x) {
building.passed = true;
LK.setScore(LK.getScore() + 1);
updateScore();
}
// Remove buildings that are off-screen
if (building.x < -400) {
building.destroy();
buildings.splice(i, 1);
}
}
// Check ground and ceiling collision
if (airplane.y <= 30 || airplane.y >= 2702) {
LK.getSound('crash').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
};
// Initialize score display
updateScore(); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,197 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var Airplane = Container.expand(function () {
+ var self = Container.call(this);
+ var airplaneGraphics = self.attachAsset('airplane', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.velocity = 0;
+ self.gravity = 0.8;
+ self.jumpPower = -12;
+ self.maxVelocity = 15;
+ self.update = function () {
+ // Apply gravity
+ self.velocity += self.gravity;
+ // Limit velocity
+ if (self.velocity > self.maxVelocity) {
+ self.velocity = self.maxVelocity;
+ }
+ if (self.velocity < -self.maxVelocity) {
+ self.velocity = -self.maxVelocity;
+ }
+ // Update position
+ self.y += self.velocity;
+ // Rotate airplane based on velocity for visual effect
+ airplaneGraphics.rotation = Math.max(-0.5, Math.min(0.5, self.velocity * 0.05));
+ // Keep airplane within screen bounds
+ if (self.y < 0) {
+ self.y = 0;
+ self.velocity = 0;
+ }
+ if (self.y > 2732) {
+ self.y = 2732;
+ self.velocity = 0;
+ }
+ };
+ self.jump = function () {
+ self.velocity = self.jumpPower;
+ LK.getSound('fly').play();
+ };
+ return self;
+});
+var Building = Container.expand(function (topHeight, bottomHeight, gapY) {
+ var self = Container.call(this);
+ // Top building
+ var topBuilding = self.attachAsset('building', {
+ anchorX: 0,
+ anchorY: 1,
+ scaleY: topHeight / 800
+ });
+ topBuilding.y = gapY - 150; // Gap size of 300px
+ // Bottom building
+ var bottomBuilding = self.attachAsset('building', {
+ anchorX: 0,
+ anchorY: 0,
+ scaleY: bottomHeight / 800
+ });
+ bottomBuilding.y = gapY + 150;
+ self.speed = -4;
+ self.passed = false;
+ self.update = function () {
+ self.x += self.speed;
+ };
+ self.checkCollision = function (airplane) {
+ var airplaneLeft = airplane.x - 60;
+ var airplaneRight = airplane.x + 60;
+ var airplaneTop = airplane.y - 30;
+ var airplaneBottom = airplane.y + 30;
+ var buildingLeft = self.x;
+ var buildingRight = self.x + 200;
+ // Check if airplane is within building's x range
+ if (airplaneRight > buildingLeft && airplaneLeft < buildingRight) {
+ // Check collision with top building
+ if (airplaneTop < topBuilding.y) {
+ return true;
+ }
+ // Check collision with bottom building
+ if (airplaneBottom > bottomBuilding.y) {
+ return true;
+ }
+ }
+ return false;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+// Game variables
+var airplane;
+var buildings = [];
+var gameSpeed = 4;
+var buildingSpawnTimer = 0;
+var buildingSpawnInterval = 90; // frames between buildings
+var gameStarted = false;
+// UI Elements
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+var instructionTxt = new Text2('TAP TO FLY', {
+ size: 80,
+ fill: 0xFFFFFF
+});
+instructionTxt.anchor.set(0.5, 0.5);
+instructionTxt.x = 1024;
+instructionTxt.y = 1366;
+game.addChild(instructionTxt);
+// Initialize airplane
+airplane = game.addChild(new Airplane());
+airplane.x = 400;
+airplane.y = 1366;
+// Update score display
+function updateScore() {
+ scoreTxt.setText(LK.getScore());
+}
+// Spawn new building
+function spawnBuilding() {
+ var gapY = Math.random() * (2000 - 700) + 700; // Gap between y=700 and y=2000
+ var topHeight = gapY - 150;
+ var bottomHeight = 2732 - (gapY + 150);
+ var building = new Building(topHeight, bottomHeight, gapY);
+ building.x = 2048 + 200; // Start off-screen to the right
+ buildings.push(building);
+ game.addChild(building);
+}
+// Game input handling
+game.down = function (x, y, obj) {
+ if (!gameStarted) {
+ gameStarted = true;
+ instructionTxt.visible = false;
+ // Spawn first building
+ spawnBuilding();
+ }
+ airplane.jump();
+};
+// Main game loop
+game.update = function () {
+ if (!gameStarted) return;
+ // Update building spawn timer
+ buildingSpawnTimer++;
+ if (buildingSpawnTimer >= buildingSpawnInterval) {
+ buildingSpawnTimer = 0;
+ spawnBuilding();
+ // Gradually increase difficulty
+ if (buildingSpawnInterval > 60) {
+ buildingSpawnInterval -= 0.2;
+ }
+ }
+ // Check collisions and update buildings
+ for (var i = buildings.length - 1; i >= 0; i--) {
+ var building = buildings[i];
+ // Check collision
+ if (building.checkCollision(airplane)) {
+ LK.getSound('crash').play();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ // Check if airplane passed building (score)
+ if (!building.passed && building.x + 200 < airplane.x) {
+ building.passed = true;
+ LK.setScore(LK.getScore() + 1);
+ updateScore();
+ }
+ // Remove buildings that are off-screen
+ if (building.x < -400) {
+ building.destroy();
+ buildings.splice(i, 1);
+ }
+ }
+ // Check ground and ceiling collision
+ if (airplane.y <= 30 || airplane.y >= 2702) {
+ LK.getSound('crash').play();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+};
+// Initialize score display
+updateScore();
\ No newline at end of file